Why does 'lowpass' give me an error?

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 件のコメント

Stephan
Stephan 2019 年 2 月 10 日
What is the value of fs?
TStudentTe
TStudentTe 2019 年 2 月 10 日
fs = 1.014066727576877e+02
Abdul Manan Dar
Abdul Manan Dar 2021 年 5 月 25 日
Check for NaN entries.
S = sparse(x);

サインインしてコメントする。

 採用された回答

Star Strider
Star Strider 2019 年 2 月 10 日

1 投票

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 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by