Menu

Custom Search

Digital Signal Processing(DSP)- Lab Programming-MATLAB

1) A Fourier series of a square wave of amplitude ‘A’ with odd symmetry is given by
x(t)=(4*A/pi)*[sin(Wot)+(1/3)*sin(3Wot)+……….
Plot x(t) and confirm the relationship between x(t) and harmonics.

t=0:0.02:6;
a=10;
w=5;
x=0;
n=input('enter no of harmonic component');
for i=1:2:n
x= x+((4*a/pi)*(1/i)*sin(i*w*t));
end
plot(t,x);
grid;
title('Square wave with odd symmetry');



enter no of harmonic component:1


enter no of harmonic component:50









enter no of harmonic component:10000






















2) To plot Imaginary,real,magnitude and phase plot of a given signal:

w=0:.01:4*pi;
num=[0.1];
den=[1 -0.25];
h=freqz(num,den,w);

subplot(2,2,1);
plot(w,imag(h));
title('Imaginary');
grid;
subplot(2,2,2);
plot(w,real(h));
title('Real');
grid;
subplot(2,2,3);
plot(w,abs(h));
title('Absolute');
grid;
subplot(2,2,4);
plot(w,angle(h));
title('Angle');
grid;




3)To plot Imaginary,real,magnitude and phase plot of a given signal:

w=0:.01:4*pi;
num=[0.009 -0.03 0.015 -0.034 0.058];
den=[1 2.7 2.47 1.56 0.42];
h=freqz(num,den,w);
subplot(2,2,1);
plot(w,imag(h));
grid;
title('Imaginary');
subplot(2,2,2);
plot(w,real(h));
grid;
title('Real');
subplot(2,2,3);
plot(w,abs(h));
grid;
title('Magnitude');
subplot(2,2,4);
plot(w,angle(h));
grid;
title('Angle');

No comments:

Post a Comment