different checklist and no chekclist "scale passband" in FDATool of Hamming window

2 views (last 30 days)
I want filtered input signal with noise in hamming window. fs=5000, fc1=1850, fc2=1910. but when i filtered with checklist scale passband the result is in figure 1. whereas no checklist scale passband the result in figure 2. why this happening and how to solve it?thanks. in my code looks out in part of "flag"
here's my code;
% FIR Window Bandpass filter designed using the FIR1 function.
% All frequency values are in Hz. Fs = 5000; % Sampling Frequency
N = 20; % Order Fc1 = 1850; % First Cutoff Frequency Fc2 = 1910; % Second Cutoff Frequency flag = 'scale'; % Sampling Flag (here's my problem) % Create the window vector for the design algorithm. win = hamming(N+1
% Calculate the coefficients using the FIR1 function. b = fir1(N, [Fc1 Fc2]/(Fs/2), 'bandpass', win, flag); Hd = dfilt.dffir(b);
%Input Signal 1880MHz %Input Signal fs=5000; t=0:1/(fs):0.1; x1=10*sin(2*pi*1880*t); x2=5*cos(2*pi*2200*t);
%Noise/Interference Signal 1000 Hz f3=1000; x3=5*cos(2*pi*f3*t);
%Input Signal with Noise/Interference Signal 2200 Hz s1=x1+x2;
%Input Signal with Noise/Interference Signal 1000 Hz s2=x1+x3;
%Figure Input Signal figure(1) plot(t,x1); a=[0 0.1 -15 15]; axis(a) grid on
%Figure Noise/Interference Signal 2200 Hz figure(2) plot(t,x2); axis(a) grid on
%Figure Noise/Interference Signal 1000 Hz figure(3) plot(t,x3); axis(a) grid on
%Figure Input with Noise/Signal 2200 Hz figure(4) plot(t,s1); axis(a) grid on
%Figure Input with Noise/Signal 1000 Hz figure(5) plot(t,s2); axis(a) grid on
%Figure Filter Signal Noise/Interference 2200 Hz s3=filter(Hd,s1); figure(6) plot(t,s3); axis([0 0.1 -20 20]) grid on
%Figure Filter Signal Noise/Interference 1000MHz s4=filter(Hd,s2); figure(7) plot(t,s4); axis([0 0.1 -20 20]); grid on
%Fourier Transform N=512; S1=fft(s1,N)*(2/fs); S2=fft(s3,N)*(2/fs); S3=fft(s2,N)*(2/fs); S4=fft(s4,N)*(2/fs); w=((0:((N/2)-1))/(N/2))*(fs/2);
%Figure FFT signal Input and Ouput with 2200MHz Noise Signal figure(8) subplot(2,1,1) plot(w,abs([S1(1:(N/2))*10'])) title('Input Signal'); xlabel('Frequency (Hz)'); ylabel('Magnitude'); grid on; subplot(2,1,2) plot(w,abs([S2(1:(N/2))*10'])) title('Output Filtered Signal'); xlabel('Frequency (Hz)'); ylabel('Magnitude'); grid on;
%Figure FFT signal Input and Ouput with 1000MHz Noise Signal figure(9) subplot(2,1,1) plot(w,abs([S3(1:(N/2))*10'])) title('Input Signal'); xlabel('Frequency (Hz)'); ylabel('Magnitude'); grid on; subplot(2,1,2) plot(w,abs([S4(1:(N/2))*10'])) title('Output Filtered Signal'); xlabel('Frequency (Hz)'); ylabel('Magnitude'); grid on;

Answers (0)

Categories

Find more on Digital and Analog Filters in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!