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

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, selenamr
Ifa component is made of two or more materials with different modulus of elasticity (e), it is called a composite member and we calculate the factor·n". mention the formula for calculating n". also, ifn> 1, explain what will happen to the 1. transformed. gi) ifn 1, what will happen to the material when transformed material when
Answers: 1
image
Engineering, 04.07.2019 18:20, yasyyas646646
Agas mixture consists of 8 kmol of h2 and 2 kmol of n2. determine the mass of each gas and the apparent gas constant of the mixture.
Answers: 3
image
Engineering, 04.07.2019 19:10, phantomlizz3233
In general, how do thermosetting plastics compare to thermoplastics in mechanical and physical properties?
Answers: 3
image
Engineering, 04.07.2019 19:10, Calliedevore
The proportional limit is always greater than the yield strength for a material. a)-trune b)- false
Answers: 3
You know the right answer?
MATLAB is an important tool that is widely used in industry to analyze dynamic systems. Each problem...

Questions in other subjects: