Question: Using matlab: When including the Matlab script file in your solutions, ensure that it ispresented in a fixed width font such as CourierNewand uses an
Using matlab:
When including the Matlab script file in your solutions, ensure that it ispresented in a fixed width font such as CourierNewand uses an appropriate font size or page margins.Do not use a font size smaller than 9 or margins that leave less than 0.75 on either side of the page.
Also, recall figures must have a numbered descriptive figure caption below the figure and that each numbered problemstarts witha short description and starts on a new numbered page.Copy all needed Matlab plots using the method described in lecture.
1.Signals such as a rectangular pulsetrain, a sincfunction,and sinusoidsare commonly seen in electrical/computer engineering lecture and laboratory courses. The aforementioned signals can all be generated and visualized using Matlab. As such, write a Matlab script file which will address the following items.Note that it may be helpful to plot intermediate results as the various steps in the solution to the problem are completed.
Create a vector named t that has 2,000 linearly spaced data points between 510^3and 510^3 using linspace. This vector will form the basis for the horizontal axis for your plot.
Next, generate a vector namedrect_pulse_trainthrough use of the Matlabsquarecommand (help squarewill let you see the specifics or you can reference the documentation page) so that rect_pulse_trainhas a value of 3 for 60% of time and a value of 0 for 40% of the time.The square command must be correctly used so that a desired period and duty cycle as well as amplitude and offset are present. You will likely use a command of the form a*square(b,c) + d to create your pulse trainit is up to you to determine the values of a, b, c, and d.In particular, the first argument for the square command is the previously defined vector t multiplied by 500
while the second argument must be a scalar value so that the duty cycle of the signal is 60%. This will yield a signal which is at +1 for 60% of the period and at 1 for the other 40% of the period. By multiplying square by an appropriate value and adding an additional appropriate value,the default 1to +1 range can be changed to 0 to 3.
Now, create an additional vector named sinc_wave using the MATLAB sinc command with the argument for since being the vector t multiplied by 2,000.The maximum value of a sinc signal is 1(do a web search to find a plot of a sinc signal), but the requirements for your sinc_wave call for the maximum value to be 4 times larger than this.
Create a final vector named sinusoid using the MATLAB cos command with the argument for cos being the vector t multiplied by 600
. Recall from mathematics courses that the minimum value cosine is -1 while the maximum value is +1. The requirements for your sinusoid are such that it has a minimum value of -1and a maximum value of +5. As such, in the same manner as when rect_pulse_trainwas found earlier, cos will need to be multiplied by an appropriate scalar and have an additional scalar added to it so that the 1to +1range is changed to -1to +5.
Then, on the same set of axes, plot the signals rect_pulse_train,sinc_wave and sinusoid as a function of t using linear horizontal and vertical axes. You will make use of the plot command we discussed in class. rect_pulse_trainis to be shown with a solid black line, sinc_waveis to be shown with a solid redline and sinusoid is to be shown with a solid blueline. All lines are to have a line width of 2. In order to change the line width of all curves, one utilizes the LineWidthcommand a single time at the end of the plot command. As an example, two curves so that the first one is a red solid line and the second one is a green dashed line with both having a line width of 3 would use plot(x1,y1,r-,x2,y2,g--,LineWidth,3).)
Lastly, modify the plot so that horizontal axis has the labeltime (s) (xlabel) while the vertical axis has the label oscilloscope reading (V)(ylabel). Also, place your name in the title (title) to the plot. Then, use the axis command (axis) to set the horizontal axis range for 510^3to 510^3and the vertical axis range for -2 to +6. Once this has been completed, use the commands
set(gca,'XTick',-5e-3:1e-3:5e-3)
set(gca,'YTick',-2:1:6)
to force the horizontal tick marks to increment by 110^3between 510^3and 510^3and the vertical tick marks to increment by 1between 3and 8. Next, turn on the grid for the plot (grid) and place a descriptive legend in the inside lower left of the plot(legend).
= Pi
Transcribed image text
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
