Band-Pass Filter butter problem
Show older comments
filter_order_bpf = 10; % filter order, larger number makes the filter
% response sharper but increases the cost
f_low_bpf = f_carrier - f_stop_lpf; % low cut-off frecuency of band-pass filter
f_high_bpf = 31e3; % high cut-off frecuency of band-pass filter
wn_bpf = [f_low_bpf, f_high_bpf]/(Fs/2); % this parameter is used by MATLAB, defines it based
% on your cut-off frequencies and your signal sampling frequency
[b_bpf, a_bpf] = butter(filter_order_bpf, wn_bpf, 'bandpass'); % creates a Butterworth band-pass filter
filt_received = filter(b_bpf, a_bpf, y_mod_am_received); % apply the filter to received signal
filt_rec_sig_FD = fft(filt_received); % calculate frequency domain of audio
filt_rec_sig_FD_amp = abs(filt_rec_sig_FD)/no_of_pnts; % calculate the amplitude of frequency domain
filt_rec_sig_FD_amp_adj = fftshift(filt_rec_sig_FD_amp); % adjust the frequency sides
figure;
semilogy(freq, rec_sig_FD_amp_adj, 'b');
hold on;
semilogy(freq, filt_rec_sig_FD_amp_adj, 'r');
xlim([10, freq_max]);
grid minor;
box on;
xlabel('Frequency (Hz)');
ylabel('Amplitude');
legend('Received', 'Filtered Received');
title('Frequency Domain of Received and Filtered Received Signals');
The error is Error using butter>butterImpl
The cutoff frequencies must be within the interval of (0,1).
Error in butter (line 59)
[varargout{1:nargout}] = butterImpl(n,Wn,varargin{:});
How do I fix this?
1 Comment
Star Strider
on 14 Dec 2023
NOTE — The transfer function implementation is generally not recommended because of potential stability problems. See the butter documentation section on Limitations for details. (This applies to all discrete filter designs, not only butter.)
Accepted Answer
More Answers (0)
Categories
Find more on Digital Filter Design 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!