subject
Engineering, 18.02.2020 20:57 kirstenb278

MATLAB is an important tool that is widely used in industry to analyze dynamic systems. Each problem set will contain an exercise that introduces various features of MATLAB. When using MATLAB, you can learn about a specific MATLAB function by typing help followed by the MATLAB function name. Typing help by itself will display a long list of topics for which help is available.

Start MATLAB and set the Current Folder to your working directory. Select New Script under the File tab and save the following MATLAB m-file as go. m in your directory. Execute the m-file by typing go at the command prompt, alternatively, press F5 when the cursor is positioned in the MATLAB editor window containing the file go. m.

% Example m-file
% Plot the sinc(x) function, where sinc(t) = sin(t) / t

t = linspace(-20,20,200); y1 = sin(t) ./ t; figure(1)
clf

plot(t, y1,’-k’) xlabel(’Time (sec)’) ylabel(’Amplitude’)

% generate a time vector

f(t) = 10 cos(ωot + 60◦),

% Now plot an exponentially weighted sinusoid y2 = exp(-abs(t/4)) .* cos(t);
hold on
plot(t, y2,’--r’)

title(’EE 350 Problem Set 1 Problem 5 Example’) xlabel(’Time (sec)’)
ylabel(’Amplitude’)
legend(’sinc(t) = sin(t)/t’, ’e^{-|t|/3} cos(t)’)

(2 points) Three of the lines in the m-file end with a semicolon. What is the function of the semicolon in MATLAB?

(2 points) What are the dimensions of the vectors t, y1, and y2 generated by the example m-file? {Hint: Use the MATLAB command whos or size.}

(2 points) Why must we use the operator .* in calculating the signals y1 and y2?

(2 points) What happens if the command hold on is removed from the m-file?

(2 points) What do the commands figure(1) and clf accomplish?

(10 points) Type help subplot at the MATLAB command line to learn about the function subplot. Add code to the example m-file so it that plots the sinusoids

y = 2e−t/2 sin(2π t)x = 2e−t/2 cos(2π t)

in the upper subplot of figure 2, and in the lower subplot of figure 2, plots y versus x for 0 ≤ t ≤ 4. Use a time vector that contains 300 uniformly spaced points. For the upper subplot, show y as a solid black curve and xas a dashdot blue curve using a single plot command line. Label the two curves in the upper subplot using the legend command. For the lower subplot, use a solid magenta curve and follow the plot command by the command line axis equal. Why benefit does the command axis equal provide?

To receive credit

Turn in figures 1 and 2 along with a copy of your m-file.

Include your name and section at the top of the m-file as comment lines.

Use the MATLAB command gtext to place your name and section number within each figure.

Make sure that you appropriately label the x and y axes; no credit is given for MATLAB plots whose axes are unlabeled.

Use the legend command to distinguish multiple curves in a single plot.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Which of the following components of a pid controlled accumulates the error over time and responds to system error after the error has been accumulated? a)- proportional b)- derivative c)- integral d)- on/off.
Answers: 2
question
Engineering, 04.07.2019 18:20
A3-mm-thick panel of aluminum alloy (k 177 w/m-k, c 875 j/kg-k and ? = 2770 kg/m) is finished on both sides with an epoxy coating that must be cured at or above t,-150°c for at least 5 min. the production line for the curing operation involves two steps: (1) heating in a large oven with air at ts,0-175°c and a convection coefficient of h, 40 w/m2. k, and (2) cooling in a large chamber with air at 25°c and a con- vection coefficient of he 10 w/m2.k. the heating portion of the process is conducted over a time interval te which exceeds the ime required to reach 150°c by 5 min (h = r + 300 s). the coating has an emissivity of ? = 0.8, and the temperatures of the oven and chamber walls are 175 and 25°c, respectively. if the panel is placed in the oven at an initial temperature of 25°c and removed from the chamber at a safe-to-touch tempera ture of 37°c, what is the total elapsed time for the two-step curing operation?
Answers: 3
question
Engineering, 04.07.2019 18:20
For a gate width of 2 m into the paper, determine the force required to hold the gate abc at its location.
Answers: 1
question
Engineering, 04.07.2019 18:20
Wiy doeres rere okhn a pump whon working betwon the same pressure range?
Answers: 2
You know the right answer?
MATLAB is an important tool that is widely used in industry to analyze dynamic systems. Each problem...
Questions
Questions on the website: 13722361