help in getting the matlab output using the fdatool

Status
Not open for further replies.

digvijay

Newbie level 1
Joined
Dec 8, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
hi.. im designin fir lowpass filter using fdatool... now i got the response n i generated the m file to see my specification which is shown below...

function Hd = fir1
%FIR1 Returns a discrete-time filter object.

%
% M-File generated by MATLAB(R) 7.3 and the Signal Processing Toolbox 6.6.
%
% Generated on: 09-Mar-2011 21:56:57
%

% Equiripple Lowpass filter designed using the FIRPM function.

% All frequency values are in Hz.
Fs = 48000; % Sampling Frequency

Fpass = 11000; % Passband Frequency
Fstop = 12000; % Stopband Frequency
Dpass = 0.17099735734; % Passband Ripple
Dstop = 0.00056234132519; % Stopband Attenuation
dens = 20; % Density Factor

% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fpass, Fstop]/(Fs/2), [1 0], [Dpass, Dstop]);

% Calculate the coefficients using the FIRPM function.
b = firpm(N, Fo, Ao, W, {dens});
Hd = dfilt.dffir(b);


now to check the functionality im passin noise sigal using following function

%noisy signal
y = wgn(10000,1,1);
Fs=2.677e6;

%%Analyze data time domain
T=1/Fs;
L=5;
t=(0:L-1)*T; %time vector

%analyze data freq domain
NFFT=L;
Y=fft(y,NFFT)/L;
f=Fs/2*linspace(0,1,NFFT/2+1);

%plot single sided amplitude spectrum
figure; plot(f,20.*log(abs(Y(1:NFFT/2+1))))

title('single sided amp of y(t)')
xlabel('freq(Hz)')
ylabel('|Y(f)|')

%change to fixed point data
y_fixed=fi(y,1,16,15);


after this i dont know how to see the output as attenuated wave.. pls help... urgent
 

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