Appendix G: (Not required information but I put it here incase it might help) b. Build a Simulink program based on the transfer function in
Appendix G: (Not required information but I put it here incase it might help)
b. Build a Simulink program based on the transfer function in Eq. (2-8) with R= 10k12 and C = 10uF. to conduct simulations. Then write a MATLAB plot program to plot the Simulink output response, the v.(t) in Eq. (2-6). (See Appendix G for details) 1. Build the Simulink program. II. Plot the Simulink simulation result, v.(t), the voltage across the capacitor. Observe how the changes of R and C will affect the response. RC dv.(t) + v.(t) = vi(t). (2-6) dt Throughout this section, the resistor R and the capacitor C of the RC circuit in Figure 2.2 are assumed R = 10k and C = 10uF. Note that the tolerance of the resistor is +5%, and the tolerance of the capacitor can be as high as +20%. Appendix G: Simulating RC Response with Simulink Introduction It is often advantageous to simulate a system's behavior for theoretical analysis and comparison with experimental trials. Many tools exist for simulating electrical and dynamic systems, one of them being Simulink. Simulink is an extension of MATLAB that allows programs and models to be built using a graphical user interface. This is different from the more familiar m-code approach where commands are entered in the MATLAB Command Window or are written in an m-file function or script. In many cases, Simulink proves to be more intuitive and practical for simulating complicated systems. Simulink models are designed graphically by connecting blocks in a flow-chart manner. The blocks can be dragged and dropped into place and interconnected. Many blocks have tunable parameters. After creating a model, the model can be run to generate an output. This output can then be plotted or used for further analysis in Matlab or using other software packages. Initial Setup and Creating a New Model Begin by setting a variable, RC, in the MATLAB Command Window to the RC value of the circuit. After defining RC=l, you will see the RC icon appears in the Workspace window showing its Value is 1. If we double click the RC icon, it will open the window named Variables - RC allowing us to see the content inside. In general, the variable can be more than a single number. It can be an array or a matrix, and hence the ability to see the whole content of the variables is meaningful. The value of RC (the time constant of the RC circuit) will be used later in the Simulink simulation. MATLAB R2021b-academic use . PL APPS VARL VIEW @ Search Documentation Bor-Chin New from Print Transpose Sort X Workspace Value Open Rows Columns 1 Insert Delete 1 Selection VARIABLE SELECTION EDIT ada: Users bcc88 Documents MATLAB Current Folder O Variables - RC Name RC X Untitled_1.m A 1x1 double Untitled.m 1 2 3 runfgWindowsXP_777-20. 1 RC_StepResponsesxc plotRCresponse.m Details Command Window >> RC = Name - RC 1 4 5 RC Select a file to view details 1 >> simulink fx >> Then, to start using Simulink, we type simulink' as the next command on the same Command Window, and hit the Enter key to pop up the following Simulink Start Page window: Simulink Start Page X SIMULINK New Examples Open Search All Recent > My Templates Learn More Projects #From Source Control Simulink Learn 0 to Simulink Onramp Lo Statelow Onramp to Control Design Onramp with Simulink Simscape Onramp to Circuit Simulation Onramp Blank Model Blank Subsystem Blank Library Blank Project Double click the 'Blank Model" icon to open a Simulink model window named 'untitled'. You can rename the file anytime by clicking 'Save' and then type the new name. To build a Simulink simulation model, we first open the Simulink Library Browser window by clicking the Library Browser icon on the Simulink model window. Untitled Simulink Library Browser Entouch SIMULATION DEBUG MODELING FORMAT APPS - O Stop Time Simulink Open Save Print TILE Ster Library Browser UEDA Inspector VIEW STS HENNE SALATE 6 untitled Simulink Commonly used Continuous Dashboard Additional Math Commonly Discontinuities & Discrete Used Blocks Discrete Logic and Bit Of Lookup Tables Math Operation Continuous Dashboard Matrix Operator Messages & Eve Ma Model Verificatic Model Wide Ut Discontinuities Discrete Ports & Subsyste Signal Attributes Signal Routing Sinks Logic and it Lookup Ready 100% Variabletup Auto On the Library Browser window, we will select and open the "Continuous' folder to drag a Transfer Fen block, which represent a continuous-time system, onto the Simulink model window as shown in the following figure. tid Simulink academic use SIMULATION DEBUG MCOEUNG FORMAT APPS BLOCK Etichete Open - Save Stop Time 100 Noma Library Howar BRARY Restart - Forward Back RE Dets sector BEWATE PD Control (200R untitled BON State Space Simulink/Continuous Simulink Commonly used Continuous Dashboard Discontinues Discrete Logic and Bit Opera Lookup Tables Math Operations Matti Operations Messages & Events Model Verification Model Wide Utilitie Ports & Subsystems Signal Aibutes Signal Routing Sinks *+1 1 Transfer For Transport Ready 100% Variabletto The Transfer Fen block now shows the transfer function with 1 as numerator and stl as the denominator, but both of them can be replaced by any polynomial as long as the degree of the numerator polynomial is less than or equal to that of the denominator polynomial. For the RC circuit system, the denominator polynomial is RCs+l while the numerator still remains as 1. To make changes, we double click the Transfer Fcn block to pop up the 'Block Parameters: Transfer Fen' window, where we can change the coefficients of the numerator and the denominator. Now we revise the denominator coefficients from [1 l) to [RC 1], and click 'Apply'. Then the denominator polynomial of the Transfer Fen block on the Simulink model is changed accordingly from st! to RCs +1 as shown in the following figure. untitled - Simulink academic use SIMULATION DEBUG MODELING FORMAT APPS Block Parameters: Transfer Fon Parameter tunability controls the runtime tunability level for numerator and denominator coefficients. 'Auto': Allow Simulink to choose the most appropriate tunability Open - Stop Time 10.0 level New Normal Print Library Browser LIBRARY 109 Signals PREPARE Fast Restart Step Run Back- SIMULATE FILE Optimized': Tunability is optimized for performance. "Unconstrained': Tunability is unconstrained across the simulation targets. Parameters Numerator coefficients: untitled Mode Browser untitled Denominator coefficients: [RC 1] RC -5+1 Transfer For Parameter tunability: Optimized Absolute tolerance: auto State Name: (e.g., "position') OK Cancel Help Ready 10096 Apply To simulate the step response of the system, a step input Source must be placed into the model. It can be found in the Source folder of the Library Browser as illustrated. MODELING FORMA 100 Stop Time Normal Fast Restart 0000 CO PRERARE titled-Simulinkacademic use Block Parameters: Step Step Output a step Main Signal Attributes Step time: 0 Initial value: 0 Final value: 5 Sample time: 0 Interpret vector parameters as 1-0 Enable zero-crossing detection Signal Generator Simulink Library Browser APPS Enter search terms Simulink/Sources Step Back - Matrix Operations SIMULATI Messages & Events Model Verification Model-Wide Utilitie Ports & Subsystems Signal Attributes Signal Routing Sinks Sources String User-Defined functi Additional Math & > Quick Insert Aerospace Blockset Audio Toolbox Automated Driving Toc RC se RC StepResponse 1 Simulink Library Browser Enter search term Simulink/Sinks Logic and Bit Operations Lookup Tables Math Operations Matrix Operations Messages & Events Model Verification Model-Wide Utilities Ports & Subsystems Signal Attributes Signal Routing Sinks Sources String User-Defined Functions Additional Math & Discrete Terminator To File Save format: Array Save 2-D signals as: 3-0 array (concatenate along the Log fixed-point data as a fi object Sample time (-1 for inherited): -1 out. Vout RC -5+1 sout TO Workspace Transfer Font To Workspace XY Grape OK Cancel Help Ready 125% autoode 45 Note that the name of the To Workspace block has been renamed as Vout, and the Save format is Array. In order to record the simulated data as functions of time, we need to add a Clock block from the library Sources and another To Workspace block to the Simulink model. The To Workspace block parameters should be tuned similarly to those illustrated earlier. Run the simulation by clicking the black triangle) at the top of the model window. This resembles a play button from a DVD player or similar device. Simulink Library Browser TODEUNG FORMAT APPS Enter search term Stop Time 10.0 Blod Parameters: To Workspace BLOC To log a bus signal, use "Timeseries" save format. Parameters Variable name: time Run Normal Fast Restart Step Back - REPARE SIMULATE Band-Limited White Noise Limit data points to last: Inf Chirp Signal Decimation: 1 Simulink/Sources Matrix Operat Messages & E Model Verifica Model-Wide Ports & Subsy Signal Attribu Signal Routing Sinks Sources String User-Defined Additional Ma Quick Insert Aerospace Blocks Audio Toolbox Automated Drivit VITOCAD Rarke. out time Clock 1 RC 5+1 out. Vout Save format: Array Save 2-D signals as: 3-D array (concatenate along thir Log fixed-point data as a fi object Sample time (-1 for inherited): -1 Constant M Counter OK Cancel 100% Help Apply The simulation results are stored in the array Vout (the output voltage of the RC circuit) and another array time (the timing information corresponding to Vout). MATLAR R021b-academicus RC StepResponse - Simulink academic use SIMULATION DEBUG MODELING FORMAT Search Documentation Bor-Chin APPS Transpose Insert Delete Sort Stop Time 100 LE LIBRARY PREPARE Normal Fast Restart Step Back- SIMULATE Step Forward RC Stepesponte RC StepResponse Workspace Name out E RC podsur de Open BOW Columns New from Print Selection VARIABLE SELECTION EDIT UDC Users becs Documents MATLAB Current Folder Variables-out Name out Untitled 1.m txt Simulation Output Untitled.m Value Property runt Windows XP RC_StepRespons- Vout 5.81 double Initial conditions E time Sex double Gyro sensor.docx tout 58x1 double agtm_simulate 6D. e Simulation. 1x1 Simulation gtm design stun Errorlessage gtr_design FGS Explore SimulationMetadata 18trimA antiwin Command Window Details >> RC=1 out me WORCE RC-5+1 out. Vout RC = Select a file to view details >> simulink >> Ready 100% autolode45) The Vout and time arrays can be employed to plot the value of Vout as function of time. On the MATLAB Command window, type the command plot (out.time, out. Vout) and press the Enter key will plot in a MATLAB figure as shown below. The step response rises up from Vout O at time = 0 exponentially with time constant = 1 second, and reaches the steady state value Vout= 5 volt shortly after 6 seconds. This figure is not suitable for use in a report or presentation, though, because it lacks titles and labels. MATLAB R2021bcademic use Search Documentation Figure 1 P4 Bor-Chin File Edit View Insert Tools Desktop Window Help H ET 4.5 Open Rows Colom Transpose Newtom Print Insert Delete Sort Selection VARIABLE SELECTOR Users bec88 Documents MATLAB Current Folder Variables-Out Name out Untitled_1.m 1x1 Simulation Output Untitled.mn rung Windows XP Property Value SRC StepRespons Vout 581 double Initial conditions time 58x1 double Gyro sensor dock tout 5&xt double 9gtm_simulate 60. SimulationM. 11 Simulation gtm_design_sfun Error Message gtm_design_FG_S Explore Simulation Metadata 18trimA antiwin Command Window Details Workspace Name out RC 3.5 3 2.5 2 1.5 >> simulink >> plot time. Vout) Unrecognized function of variable time! Select a file to view details 05 >> plot (out. time, out. Vout) fx >> 0 2 10 An m-file MATLAB script can be created to plot the step response with titles, labels, and grid as shown below. Run the script to generate a new plot. Plot RC step response of the simulated system plot (out.time, out. Vout) xlabel ('Time [sec]') ylabel ('Vout [volts]') grid title('Step Response of RC Circuit') The newly plotted figure will contain appropriate titles, labels, and grid lines. Analyze SECTION MATLAB R2021-academic use Figure 1 - Search Documentation File Edit View Insert Tools Desktop Window Help % ad DE DE Compare Profile Find New Oper Save Go To Refactor N Bookmark - FA Step Response of RC Circuit FILE MAGATE COO ANALVIE Users bcc88 - Documents MATLAB 4.5 Current Folder Variables-out Editor plot Cresponse.mx Works Name plotRCresponse.mx + Name- Untitled_1.m Plot RC response of the simulated system out Untitled. 2 plot(out.time, out. Vout) HRC 3.5 3 rung WindowsXP-7-
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance