Write a MATLAB program called SinCurve to plot one cycle of f(t)=sin(wt) using t
ID: 3405054 • Letter: W
Question
Write a MATLAB program called SinCurve to plot one cycle of f(t)=sin(wt) using t = 100 linearly-spaced points from 0 to T, where T is the period of the sine curve.
The period of f(t)=sin(wt) is 2pi/w
The program should prompt the user for the value of w (called angular frequency). The sine curve should be plotted with a green line, and should include a title. For example:
IMPORTANT NOTE: Cody does not display a figure window, However, Cody can test for the correctness of items on the figure window.
Name the input variable w . Place the array of 100 values into an output variable named t .
The output will look like this, for any value of w
Explanation / Answer
Required Matlab Code for it:
t = [0:1/10:100];
A = 1;
w=100;
y = A*sin(2*pi*t/w);
plot(t(1:100),y(1:100), 'g')
xlabel('Time'), ylabel('Sine wave')
title('Sine Wave vs Time');
zoom xon;
thank you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.