Professional Documents
Culture Documents
Date :
LINEAR CONVOLUTION
AIM:
EQUIPMENT:
PROGRAM:
RESULT:
CIRCULAR CONVOLUTION
AIM:
EQUIPMENT:
PROGRAM:
x=[1 1 1 1 2];
h=[1 2 1 1];
nx=length(x);
nh=length(h);
N=max(nx,nh);
y=cconv(x,h,N);
n=0:1:nx-1;
subplot(2,2,1);
stem(n,x);
xlabel('-->n');
ylabel('-->x(n)');
title('input sequence');
n=0:1:nh-1;
subplot(2,2,2);
stem(n,h);
xlabel('-->n');
ylabel('-->x(n)');
title('imulse sequence');
n=0:1:N-1;
subplot(2,2,3);
stem(n,y);
xlabel('-->n');
ylabel('-->x(n)');
title('resultant sequence');y
RESULT:
RECTANGULAR WINDOW
AIM:
To design FIR filter using rectangular window technique.
EQUIPMENT:
1. Operating System : Windows XP
2. Constructor : Simulator
3. Software : Matlab Software
PROGRAM:
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter the passband freq');
fs=input('enter the stopband freq');
f=input('enter the sampling freq');
wp=2*fp/f; ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem); n1=n+1;
if(rem(n,2)~=0)
n1=n; n=n-1; end;
y=boxcar(n1);
b=fir1(n,wp,y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(om/pi,m);
ylabel('gain in db');
xlabel('(a) normalized freq');
b=fir1(n,wp,'high',y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(om/pi,m);
ylabel('gain in db');
xlabel('(b) normalized freq');
wn=[wp,ws];
b=fir1(n,wn,y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(om/pi,m);
ylabel('gain in db');
xlabel('(c) normalized freq');
b=fir1(n,wn,'stop',y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(om/pi,m);
ylabel('gain in db');
xlabel('(c) normalized freq');
RESULT:
TRIANGULAR WINDOW
AIM:
To design FIR filter using triangular window technique.
EQUIPMENT:
1. Operating System : Windows XP
2. Constructor : Simulator
3. Software : Matlab Software
PROGRAM:
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter the passband freq');
fs=input('enter the stopband freq');
f=input('enter the sampling freq');
wp=2*fp/f; ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem); n1=n+1;
if(rem(n,2)~=0)
n1=n; n=n-1; end;
y=bartlett(n1);
b=fir1(n,wp,y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(om/pi,m);
ylabel('gain in db');
xlabel('(a) normalized freq');
b=fir1(n,wp,'high',y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(om/pi,m);
ylabel('gain in db');
xlabel('(b) normalized freq');
wn=[wp,ws];
b=fir1(n,wn,y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(om/pi,m);
ylabel('gain in db');
xlabel('(c) normalized freq');
b=fir1(n,wn,'stop',y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(om/pi,m);
ylabel('gain in db');
xlabel('(c) normalized freq');
RESULT:
KAISER WINDOW
AIM:
To design FIR filter using kaiser window technique.
EQUIPMENT:
1. Operating System : Windows XP
2. Constructor : Simulator
3. Software : Matlab Software
PROGRAM:
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter the passband freq');
fs=input('enter the stopband freq');
f=input('enter the sampling freq');
beta=input('enter the beta value');
wp=2*fp/f; ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem); n1=n+1;
if(rem(n,2)~=0)
n1=n; n=n-1; end;
y=kaiser(n1,beta);
b=fir1(n,wp,y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(om/pi,m);
ylabel('gain in db');
xlabel('(a) normalized freq');
b=fir1(n,wp,'high',y);
[h,om]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(om/pi,m);
ylabel('gain in db');
RESULT:
EQUIPMENT:
1. Operating System : Windows XP
2. Constructor : Simulator
3. Software : Matlab Software
PROGRAM:
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
wp=input('enter the passband freq');
ws=input('enter the stopband freq');
fs=input('enter the sampling freq');
w1=2*wp/fs;
w2=2*ws/fs;
w=0:0.01:pi;
[n,wn]=buttord(w1,w2,rp,rs,'s');
[b,a]=butter(n,wn,'s');
[h,om]=freqs(b,a,w);
m=20*log10(abs(h));
subplot(2,1,1);
plot(om/pi,m);
xlabel('normalised freq');
ylabel('gain in db');
title('design of butterworth filter');
an=angle(h);
subplot(2,1,2);
plot(om/pi,an);
xlabel('normalised freq');
ylabel('phase in radians');
RESULT:
EQUIPMENT:
1. Operating System : Windows XP
2. Constructor : Simulator
3. Software : Matlab Software
PROGRAM:
rp=input('enter the pass band ripple');
rs=input('enter the stop band filter');
ws=input('enter the pass band freq');
wp=input('enter the stop band freq');
fs=input('enter the sampling freq');
w1=2*wp/fs;
w2=2*ws/fs;
w=0:0.01:pi;
[n,wn]=buttord(w1,w2,rp,rs,'s');
[b,a]=butter(n,wn,'high','s');
[h,om]=freqs(b,a,w);
m=20*log10(abs(h));
subplot(2,1,1);
plot(om/pi,m);
xlabel('normalized freq');
ylabel('gain in db');
title('design of butter worth high pass filter');
an=angle(h);
subplot(2,1,2);
plot(om/pi,an);
xlabel('normalized freq');
ylabel('phase in radians');
RESULT: