In this example, we use sinusoidal wave and plot data several different figure.
% In this example, we use sinusoidal wave and plot data several different
% figure
t = 0:0.05:3; % sample points between 0-3
x = sin(2*pi*t); % sinusoidal value
%% Figure 1
% We have one figure screen and it has 3 figure. This is first figure
subplot(3,1,1);
plot(t,x);
xlabel('t in second');
ylabel('x(t)');
title('sin(2\pit)');
%% Figure 2
% This is second figure, we plot x(t) value on figure 1
subplot(3,1,2);
plot(t,x,'b');
xlabel('t in sec');
ylabel('x(t)');
title('sin(2\pit)');
hold on
plot(t,x,'ro');
%% Figure 3
% This last figure, we plot x(t) and use stem function
subplot(3,1,3);
plot(t,x,'b');
hold on
stem(t,x,'r','fill');

Comments
Post a Comment