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 12:10
On a average work day more than work place firs are reorted
Answers: 1
question
Engineering, 04.07.2019 18:10
Coiled springs ought to be very strong and stiff. si3n4 is a strong, stiff material. would you select this material for a spring? explain.
Answers: 2
question
Engineering, 04.07.2019 18:20
Find the kinematic pressure of 160kpa. for air, r-287 j/ kg k. and hair al viscosity of air at a temperature of 50°c and an absolute (10 points) (b) find the dynamic viscosity of air at 110 °c. sutherland constant for air is 111k
Answers: 3
question
Engineering, 04.07.2019 18:20
How much power could a wind turbine produce if it had the following specifications? cp = 0.45 -d=1.2kg/m3 d=50m v 5m/s
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
question
Social Studies, 22.03.2021 19:00
question
Mathematics, 22.03.2021 19:00
question
Mathematics, 22.03.2021 19:00
question
Mathematics, 22.03.2021 19:00
question
English, 22.03.2021 19:00
Questions on the website: 13722367