Write a MATLAB program to graph current, i(t), in amperes versus time, t in seco
ID: 3940120 • Letter: W
Question
Write a MATLAB program to graph current, i(t), in amperes versus time, t in seconds, for the function i(t) = 50e^(-2t)sin(4t) from t = 0 to 2.5 using about 100 points. Specific requirements include:
a. Use vectors to store the values
b. Include MATLAB commands in the program such that the graph will include: • A title, including your name (for example: i(t) versus t – John Doe) • Axis labels (include variable name, variable symbol, and units) • Gridlines • Linear scales • Blue stars for the points and a dashed line
c. Include plenty of comments in your program.
Explanation / Answer
t = 0:0.025:2.5; %creating time vector
i = 50.*exp(-2.*t).*sin(4.*pi.*t); %calculating i for each t
%plot
figure
plot(t,i, '--*') %plotting the values. Blue stars with dashed lines
grid on %creating grid
title('i(t) versus t - John Doe') %setting title
xlabel('time (t) in seconds') % setting x-axis label
ylabel('current (i) in amperes') % setting y-axis label
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.