Why does 'lowpass' give me an error?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
TStudentTe
am 10 Feb. 2019
Kommentiert: Abdul Manan Dar
am 25 Mai 2021
I have this line of code
y = lowpass(A,10/fs,fs);
and I get this error
Undefined function 'lowpass' for input arguments of type 'double'.
A is an arrray of doubles that is 9191x1 and fs is a double. I've tied using single() on all three of the arguments but this doesn't help. Also on the page for this function it says nothing about not allowing doubles.
Does anyone know what I am doing wrong?
3 Kommentare
Akzeptierte Antwort
Star Strider
am 10 Feb. 2019
The lowpass function was introduced in R2018a.
You can easily design your own filter if you are using 2017b or earlier.
A Prototype Lowpass Filter —
Ts = 0.001; % Sampling Interval (s)
Fs = 1/Ts; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency (Hz)
Wp = 0.001; % Passband Frequency For Lowpass Filter (Hz)
Ws = 0.0012; % Stopband Frequency For Lowpass Filter (Hz)
Rp = 1; % Passband Ripple For Lowpass Filter (dB)
Rs = 50; % Stopband Ripple (Attenuation) For Lowpass Filter (dB)
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Calculate Filter Order
[z,p,k] = ellip(n,Rp,Rs,Wp); % Calculate Filter
[sos,g] = zp2sos(z,p,k); % Second-Order-Section For Stability
% A_Filt = filtfilt(sos,g,A); % Filter Signal
figure
freqz(sos, 2^14, Fs) % Filter Bode Plot (Check Performance)
set(subplot(2,1,1), 'Xlim',[0 1])
set(subplot(2,1,2), 'Xlim',[0 1])
Make necessary changes to the filter design parameters to create your filter. You may not need ‘Ts’ although you will need all the rest.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Digital Filter Design finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!