Solutions
Course Outline HW & Homework Assignments
   
 

 
% subplots of  y = a * sin ( omega * t + phi )

fprintf('\n\n The plots of y = a * sin(omega * t + phi) ');
fprintf('\n   for various values of the parameters ');
 
t = 0:.1:20;
 
fprintf('\n\n   a = 0.1, phi = 0.5 and various omega');   

a = 0.1;
phi = 0.5;
omega = 0.1;
y1 = a * sin(omega * t + phi);
omega = 1;
y2 = a * sin(omega * t + phi);
omega = 5;
y3 = a * sin(omega * t + phi);


subplot(2,2,1),plot(t,y1,'r'),hold on, plot(t,y2,'g.'),hold on, plot(t,y3,'b'),
               title(' omega = 0.1, 1, 5 ');

%__________________________________________________________________

fprintf('\n\n   omega = 1, phi = 0.5 and various  a');   

omega = 1;
phi = 0.5;
a = 0.1;
y1 = a * sin(omega * t + phi);
a = 2;
y2 = a * sin(omega * t + phi);
a = 6;
y3 = a * sin(omega * t + phi);

subplot(2,2,2),plot(t,y1),hold on, plot(t,y2),hold on, plot(t,y3),
               title(' a = 0.1, 2, 6 ');
               
%________________________________________________________________
              
fprintf('\n\n   a = 1, omega = 1 and various phi');   
               
omega = 1;
a = 1;
phi = 0.1;
y1 = a * sin(omega * t + phi);
phi = 0.5;
y2 = a * sin(omega * t + phi);
phi = 2;
y3 = a * sin(omega * t + phi);

subplot(2,2,3),plot(t,y1,'r'),hold on, plot(t,y2,'g'),hold on, plot(t,y3,'b'),
               title(' phi = 0.1, 0.5, 2 ');
                

 

 

Jacob Y. Kazakia © 2001 All rights reserved