Detrend specified inputs/outputs

조회 수: 7 (최근 30일)
Kyle Brown
Kyle Brown 2015년 9월 9일
답변: Kyle Brown 2015년 9월 9일
Hi,
I have a data set composed of several inputs and outputs in the form.
data = idata(Y,U,Ts)
Where Y is my outputs and U are my inputs.
I would like to use the detrend function to deterrent only some of my inputs and outputs. Others I want to leave as they are. However,
data_d = detrend(data)
detrends all my data.
Thank you for any help you can offer.

채택된 답변

Kyle Brown
Kyle Brown 2015년 9월 9일
I worked out a way to do this. I'll post it case anyone has similar issues in the future.
For a time-domain data that is defined as:
data = iddata(Y,U,Ts);
Where Y and U are multiple inputs and outputs respectively. Specific inputs and outputs can be called using:
data_c(:,{'y1','y2','y4','y5','y6'},{'u1','u2','u3'})
We can then detrend the stated outputs only.
data_r = detrend(data_c(:,{'y1','y2','y4','y5','y6'},{'u1','u2','u3'}));
However, we must re-build the iddata.
Yf = [data_r.y(:,1) data_r.y(:,2) data.y(:,3) data_r.y(:,3) data_r.y(:,4) data_r.y(:,5)];
Uf = [data_r.u(:,1) data_r.u(:,2) data_r.u(:,3) data.u(:,4)];
data_f = iddata(Yf,Uf,Ts);
Note that the detrend data has changed the order of the inputs and outputs, with the numerical values following the order they were entered. You must adjust accordingly.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Preprocess Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by