Converting iddata to a double

36 Ansichten (letzte 30 Tage)
Nick
Nick am 29 Apr. 2011
Beantwortet: Koke Yao am 24 Feb. 2020
I have a data set from an experiment that I have converted to an iddata object to simplify filtering. However, after filtering the data, I would like to perform algorithms that would normally be performed on vector data. I cannot find a way to do these processes to the iddata object, so I would like to convert back to a vector. I have found no way to convert these data back to a vector format to manipulate it. Is this possible to do in Matlab? Or would it be easier to filter the data in the vector format initially?

Antworten (4)

Jarrod Rivituso
Jarrod Rivituso am 29 Apr. 2011
Is this what you mean?
%Create fake data
u = (0:0.01:2*pi)';
y = sin(u) + 0.1*randn(size(u));
%Create iddata object
data = iddata(y,u,0.01);
%Filter iddata object
dataFilt = idfilt(data,{[1/3 1/3 1/3],[1]})
%Get new data back
uNew = dataFilt.u;
yNew = dataFilt.y;
As for other ways to filter, there are many. Check out demos for the Signal Processing Toolbox, or the basic MATLAB filter function.

Julian Antolin
Julian Antolin am 13 Apr. 2017
Note: This question was asked a long time ago and you surely have figured out what you need to do. However, I will post my reply just in case it's helpful to somebody else.
I had the same question as you. Looking through search results, I came across a Mathworks site that answered it for me.
If, say, you have a 2 channel signal in an iddata structure, you can access the output channels by: y1 = data.y(:,1); y2 = data.y(:,2);
Now y1 and y2 are regular double arrays.
Julian
  1 Kommentar
Ill ch
Ill ch am 23 Okt. 2019
Hi Julian,
Is it possible to convert it in cellstr . i am trying it but getting error.
cellstr(num2str(data.y(:,1)))];

Melden Sie sich an, um zu kommentieren.


zahra jfr
zahra jfr am 12 Mär. 2017
dear Nick you can type data.y or data.u in command window in order to see output or input of the data,respectively. best regards!

Koke Yao
Koke Yao am 24 Feb. 2020
vector = get( iddata, 'outputData' )

Community Treasure Hunt

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

Start Hunting!

Translated by