Write a MATLAB script which plots sint sin3t and sin10t 1 Al
Write a MATLAB script which plots sin(t), sin(3t), and sin(10t)
1. Allow the user to input tmin and tmax
2. Plot the three curves on the same figure.
3. Use subplot to put three individual plots on the same figure.
*Make sure to label your axes and include a legend identifying the three plots.
*Make sure your fonts are large enough and readable.
*Try 0 t 2
Solution
clc
 clear all
 close all
%% Taking User Input and defining Output
tmin=input(\'Enter minimum time tmin:\');
 tmax=input(\'Enter maximum time tmax:\');
t=linspace(tmin,tmax,1000); % Defining time interval
y1=sin(t); % Defining function outputs
 y2=sin(3*t);
 y3=sin(10*t);
%% Plotting sine plot in same window
figure
plot(t,y1,t,y2,t,y3,\'linewidth\',1)
 xlabel(\'time\')
 ylabel(\'f(t)\')
 legend(\'sin(t)\',\'sin(3t)\',\'sin(10t)\',\'Location\',\'BestOutside\')
%% Plotting sine plot in same window using subplot
figure
subplot(311)
 plot(t,y1,\'linewidth\',2)
 xlabel(\'time\')
 ylabel(\'f(t)\')
 title(\'sin(t)\')
 grid on
subplot(312)
 plot(t,y2,\'linewidth\',2)
 xlabel(\'time\')
 ylabel(\'f(t)\')
 title(\'sin(3t)\')
 grid on
subplot(313)
 plot(t,y3,\'linewidth\',2)
 xlabel(\'time\')
 ylabel(\'f(t)\')
 title(\'sin(10t)\')
 grid on


