Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions