Question: 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 well-commented 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 Clock/Timer Block and a To Workspace Block
(vi) Uses a xed sample time of 0.01, and an automatic solver selection (See Model Conguration Parameters)
Save your block diagram in the current working folder with a descriptive name, such as Part_a_Model.
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 =2, b =3, c =0.25, d =1.
Next, call the block diagram and run the simulation for 10 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.
SimData=sim(Part_a_Model)
Yvals=SimData.SimOut
Xvals=SimData.TimeOut
(ii) Next, make a plot of the output variable as a function of time, including a title, legend, grid, x-label, and y-label.
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 =2, b =3, c =0.25, d =1.
(ii)(ii) Call the modied block diagram and run the simulation for 10 seconds
(iii)(iii) On the same set of axes, make a plot of the two output variables as a function of time, including a title, legend, grid, x-label, and y-label
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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!