Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part a ) Build a well - commented block diagram that performs all of the following operations: ( i ) Adds two constant values a
Part a
Build a wellcommented block diagram that performs all of the following operations:
i Adds two constant values a and b together.
ii Multiplies the result from i with a Sine Wave of amplitude c and frequency d in Hz Make sure the sine wave block is using the simulation time as an input, NOT the external signal option.
iii Integrates the result from ii with an initial condition of zero.
iv Stores the nal result from iii into an Array in the MATLAB workspace called SimOut using the To Workspace Block
v Saves a time vector called TimeOut using the ClockTimer Block and a To Workspace Block
vi Uses a xed sample time of and an automatic solver selection See Model Conguration Parameters
Save your block diagram in the current working folder with a descriptive name, such as PartaModel
Note: Your simulation will not run until you complete part b
Part b
Start a new script, begin a code cell for Part b Your code should perform the following when executed:
i Dene the variables a b c and d Begin with a b c d
Next, call the block diagram and run the simulation for seconds. The sim Function can be run from a MATLAB script. In this case storing the data in a variable SimData the data can be accessed in the following way.
SimDatasimPartaModel
YvalsSimData.SimOut
XvalsSimData.TimeOut
ii Next, make a plot of the output variable as a function of time, including a title, legend, grid, xlabel, and ylabel.
Part c
Suppose now you are interested in viewing the signal prior to being integrated.
To do this, make a copy of your model from Part a and rename it Then modify this new model to output the signal prior to being integrated as well as the original signal.
In the same script, begin a new code cell for Part c Your code should perform the following when executed:
i Dene the variables a b c d Begin with a b c d
iiii Call the modied block diagram and run the simulation for seconds
iiiiii On the same set of axes, make a plot of the two output variables as a function of time, including a title, legend, grid, xlabel, and ylabel
Please show how to write all code in MATLAB including how to create the Simulink Model of Part a
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
Get Started