Experiment 6
Experiment 6
clc;
close all;
clear all;
t=0:0.001:9;
f=0.9;
% sine wave
y1=2*sin(2*pi*f*t);
subplot(3,4,1);
plot(t,y1);
title('sine wave');
y2=fft(y1);
subplot(3,4,2);
plot(t,y2);
y3=fftshift(y2);
subplot(3,33);
plot(t,y3);
y4=abs(y3);
subplot(3,4,4);
plot(t,y4);
title('abs value of sine wave');
% cosine wave
y5=10*cos(2*pi*f*2*t);
subplot(3,4,5);
plot(t,y5);
title('cosine wave');
y6=fft(y5);
subplot(3,4,6);
plot(t,y6);
y7=fftshift(y6);
subplot(3,4,7);
plot(t,y7);
y8=abs(y7);
subplot(3,4,8);
plot(t,y8);
% square wave
y9=0.5*1*0.5*square(2*pi*f*t);
subplot(3,4,9);
plot(t,y9);
title('square wave');
y10=fft(y9);
subplot(3,4,10);
plot(t,y10);
y11=fftshift(y10);
subplot(3,4,11);
plot(t,y11);
y12=abs(y11);
subplot(3,4,12);
plot(t,y12);