Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %rectangular signal
- Amp1=400;
- Amp2=320;
- freq=300;
- cycle=3;
- subplot(2,1,1);
- x1=0: 0.00001: 0.01;
- y1=Amp1*square(2*pi*freq*x1+0)
- x2=0: 0.00001:0.01;
- y2=Amp2*square(2*pi*freq*x1+0)
- plot(x1,y1,x2,y2)
- title('Rectangular Signal')
- set(gca,'xtick',0:0.00166666:0.01);
- set(gca,'xticklabel',{'0','pi','2pi','3pi','4pi','5pi','6pi'})
- set(gca,'ytick',-400:80:400);
- set(gca,'yticklabel',{'-400','-320','-240','-160','-80','0','80','160','240','320','400'});
- xlabel('time');
- ylabel('amplitude');
- %triangular
- Amp1=280;
- Amp2=340;
- freq=450;
- cycle=8;
- subplot(2,1,2);
- x1=0: 0.00001: 0.01777777;
- y1=Amp1*sawtooth(2*pi*freq*x1)
- x2=0: 0.00001:0.0177777;
- y2=Amp2*sawtooth(2*pi*freq*x1)
- plot(x1,y1,x2,y2)
- title('Rectangular Signal')
- set(gca,'xtick',0:0.004425:0.017777);
- set(gca,'xticklabel',{'0','4pi','8pi','12pi','16pi'})
- set(gca,'ytick',-350:70:350);
- set(gca,'yticklabel',{'-350','-280','-210','-140','-70','0','70','140','210','280','350'});
- xlabel('time');
- ylabel('amplitude');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement