There are 4 cos signals with 10,20,30 and 100 Hz each. The main signal is the sum of those 4 and I have to create a low pass filter, on the main signal for the frequency's > 50 Hz.
% design of low pass filter f = [0 0.6 0.6 1]; m = [1 1 0 0 ]; b = fir2(30, f, m); [h, w] = freqz(b,1,128); hold on; plot(f,m,'b') plot(w/pi, abs(h), 'r') xlabel('Normalized Frequency (\times\pi rad/sample)') ylabel('Magnitude') legend('Ideal', 'fir2 designed') legend boxoff title('comparison of frequency Response Magnitytes'); hold off;
That's the example code that our professor gave us.On maltab using help fir2 there is a similar example
% Example 1: % Design a 30th-order lowpass filter and overplot the desired % frequency response with the actual frequency response. f = [0 0.6 0.6 1]; % Frequency breakpoints m = [1 1 0 0]; % Magnitude breakpoints b = fir2(30,f,m); % Frequency sampling-based FIR filter design [h,w] = freqz(b,1,128); % Frequency response of filter plot(f,m,w/pi,abs(h)) legend('Ideal','fir2 Designed') title('Comparison of Frequency Response Magnitudes')
What i don't understand is how to find the frequency breakpoints and the magnitude breakpoints? Also whats the relation of the filter order with the low-high, band filters?