Effacer les filtres
Effacer les filtres

Not enough input arguments

2 vues (au cours des 30 derniers jours)
G
G le 8 Nov 2018
Commenté : Stephen23 le 9 Nov 2018
I am not understanding why I am getting this error.
clear,clc
load('DATA_01_TYPE01.mat')
A = sig;
x = A(2,1:1000); %PPG channel
y=A(3,1:1000); %x-axis acceleration
t=1:1:1000;
Fs = 125;
Fn = Fs/2
[x,y]=butter(2,[0.4 5]/Fn);
d = designfilt('bandpassiir','FilterOrder',2,'HalfPowerFrequency1',0.4,'HalfPowerFrequency2',5, 'SampleRate',125);
sos = ss2sos(x,y);
N=normalize(x,y)
subplot(3,1,1)
plot(t,sos)
title('Raw Signals')
xlabel('Sampling Points')
legend('PPG','Acceleration','Location','Southeast','Orientation','Horizontal')
Command Window:
Error using ss2sos (line 78)
Not enough input arguments.
Error in Butterworth_Practice (line 33)
sos = ss2sos(x,y);

Réponse acceptée

Stephen23
Stephen23 le 8 Nov 2018
Modifié(e) : Stephen23 le 8 Nov 2018
Read the documentation. The ss2sos help clearly lists all of the syntaxes that it supports, and none of them have only two input arguments: the smallest number of input arguments is four state-space matrices.
The MATLAB help even has examples, so you do not need to guess how to use functions:
[A,B,C,D] = butter(5,0.2);
sos = ss2sos(A,B,C,D)
From that you can quickly figure out that you need to get butter to return the four state-space matrices, not just the two transfer coefficients as you are doing.
  3 commentaires
G
G le 8 Nov 2018
Also, I am trying to plot x and y after they get filtered so I do not understand why I need the [A,B,C,D] for sos
Stephen23
Stephen23 le 9 Nov 2018
"Ok now I am getting this error:"
Error using plot
Vectors must be the same length.
You generate sos entirely independently of t (there is absolutely no connection between them at all), so I don't see why you expect them to be the same length for plotting.
You could certainly plot sos by itself:
plot(sos)
Otherwise define t based on the size of sos.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by