Matlab code for FIR filter design

Status
Not open for further replies.
clear all;
close all;
rp=input('enter the pass band ripple');
rs=input('enter the stop band ripple');
fp=input('enter the pass band ferquency');
fs=input('enter the stop band frequency');
f=input('enter the sampling frequency');
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,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);

hi please give input values also..
i have given the values like
enter the pass band ripple0.06
enter the stop band ripple0.04
enter the pass band ferquency50
enter the stop band frequency40
enter the sampling frequency70
so the matlab shown the error like ;
?? Error using ==> check_order at 19
Order cannot be less than zero.

Error in ==> boxcar at 12
[n,w,trivialwin] = check_order(n_est);

Error in ==> noisefilter at 18
y=boxcar(n1);

so please help me..
thnxz for advance.../';
 

Hi guys I have problem to solve the data from my experiments. I got a sine wave data with noise. Therefore I want to create a matlab program that can remove this noise and plat a nice sine-wave. I never used matlab before, hope anyone can help me out. here I attached the picture of sine wave that I got. The data is stored in excel.
 

hi.. i really need this help.. how do u design an fir low pass filter without built-in functions.? plz help.. it shud be done by the window method.. i need th code for it.. plz help.. thanks
 

hi.. thank you so much.. its arun.k.mudaliar at gmail dot com..
 

Can you plz tell me can I design any other filter in the matlab which is not in built there?
 

Can you plz tell me can I design any other filter in the matlab which is not in built there?

hi.. yes obviously u can design other filters.. jus get ur logic right n write ur program (m file) properly so tht matlab understands, n u can design anythin u wanna.! try th latest version of matlab to get max benefit..
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…