Tuesday, 15 March 2011

FIR filter matlab code

Matlab code for Finite impulse response (FIR) filters.

EQUIPMENTS:

Operating System         – Windows XP
Constructor                  - Simulator
Software                      - CCStudio 3 & MATLAB 7.5

THEORY:
A Finite Impulse Response (FIR) filter is a discrete linear time-invariant system whose output is based on the weighted summation of a finite number of past inputs. An FIR transversal filter structure can be obtained directly from the equation for discrete-time convolution.
                                           

In this equation, x(k) and y(n) represent the input to and output from the filter at time n.  h(n-k) is the transversal filter coefficients at time n. These coefficients are generated by using FDS (Filter Design Software or Digital filter design package).

FIR – filter is a finite impulse response filter. Order of the filter  should be specified. Infinite response is truncated to get finite impulse response. placing  a window of finite length does this. Types of windows available are Rectangular, Barlett, Hamming, Hanning, Blackmann window etc. This FIR filter is an all zero filter.




PROGRAM:

%fir filt design  window techniques
clc;
clear all;
close all;

rp=input('enter passband ripple');
rs=input('enter the stopband ripple');
fp=input('enter passband freq');
fs=input('enter stopband freq');
f=input('enter 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
c=input('enter your choice of window function 1. rectangular 2. triangular 3.kaiser: \n ');
if(c==1)
    y=rectwin(n1);
    disp('Rectangular window filter response');
end
if (c==2)
    y=triang(n1);
   disp('Triangular window filter response');
end
 if(c==3)
     y=kaiser(n1);
   disp('kaiser window filter response');
 end

%LPF
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);plot(o/pi,m);
title('LPF');
ylabel('Gain in dB-->');
xlabel('(a)         Normalized frequency-->');
%HPF
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);plot(o/pi,m);
title('HPF');
ylabel('Gain in dB-->');
xlabel('(b)         Normalized frequency-->');
%BPF
wn=[wp ws];
b=fir1(n,wn,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);plot(o/pi,m);
title('BPF');
ylabel('Gain in dB-->');
xlabel('(c)         Normalized frequency-->');
%BSF
b=fir1(n,wn,'stop',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);plot(o/pi,m);
title('BSF');
ylabel('Gain in dB-->');
xlabel('(d)         Normalized frequency-->');
 
 
 

Matlab filters

AIM:
To verify response of analog Low pass filter (LPF) & High pass filter(HPF) using MATLAB


 
EQUIPMENTS:

Operating System         – Windows XP
Constructor                  - Simulator
Software                      - CCStudio 3 & MATLAB 7.5


THEORY:

Analog Low pass filter & High pass filter are obtained by using butterworth or chebyshev filter with coefficients are given. The frequency – magnitude plot gives the frequency response of the filter.

PROGRAM:
 
Matlab code for filters

%  IIR filters LPF & HPF
clc;
clear all;
close all;
warning off;
disp('enter the IIR filter design specifications');
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;
[n,wn]=buttord(w1,w2,rp,rs,'s');
c=input('enter choice of filter 1. LPF 2. HPF \n ');
if(c==1)
    disp('Frequency response of  IIR LPF is:');
[b,a]=butter(n,wn,'low','s');
end
if(c==2)
    disp('Frequency response of  IIR HPF is:');
[b,a]=butter(n,wn,'high','s');
end
w=0:.01:pi;
[h,om]=freqs(b,a,w);
m=20*log10(abs(h));
an=angle(h);
figure,subplot(2,1,1);plot(om/pi,m);
title('magnitude response of  IIR filter is:');
xlabel('(a) Normalized freq. -->');
ylabel('Gain in dB-->');
subplot(2,1,2);plot(om/pi,an);
title('phase response of  IIR filter is:');
xlabel('(b) Normalized freq. -->');
ylabel('Phase in radians-->');


 

Tuesday, 15 February 2011

Sakurai Modern Quantum Mechanics Solutions Manual

Sakurai Modern Quantum Mechanics Solutions Manual

Revised edition includes discussions of fundamental topics and newer developments such as neutron interferometer experiments, Feynman path integrals, correlation measurements, and Bell's inequality. DLC: Quantum theory.

Modern Quantum Mechanics


DOWNLOAD

LinkWithin

Related Posts Plugin for WordPress, Blogger...