フィルターのクリア

Error using detrend. Too many output arguments

2 ビュー (過去 30 日間)
Christoph Thorwartl
Christoph Thorwartl 2020 年 7 月 15 日
コメント済み: Star Strider 2020 年 7 月 15 日
I would like to run this function.
[dataL_d,Tr] = detrend(dataL,1);
However, the following error always occurs:
Error using detrend. Too many output arguments.
I need the Tr information. If I do not want to output Tr, it works. See command below.
[dataL_d] = detrend(dataL,1);
I would be very happy about an answer.
Best regards,
Christoph

採用された回答

Star Strider
Star Strider 2020 年 7 月 15 日
You are asking detrend to remove a linear trend.
To get the slope and intercept of your data, use the polyfit function. There is no specified independent variable value, so use the index vector for that:
P = polyfit((1:numel(dataL)), dataL, 1)
The slope is ‘P(1)’ and the intercept is ‘P(2)’.
  3 件のコメント
Steven Lord
Steven Lord 2020 年 7 月 15 日
That version of detrend is part of System Identification Toolbox and is a method of iddata objects. It is only called if the first input in your call is an iddata object. If the first input is a double precision array MATLAB calls the detrend function included in MATLAB.
Star Strider
Star Strider 2020 年 7 月 15 日
My pleasure!
I have not looked at the code for the MATLAB detrend function, however I suspect it uses polyfit (and polyval) to calculate and subtract the trend.
The System Identification Toolbox detrend function (the one you linked to) is a different detrend function altogether. To use it, you must have the System Identification Toolbox, and the argument must be created by the iddata function. They are quite definitely not the same.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePreprocess Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by