For Loop Help Needed
1 回表示 (過去 30 日間)
古いコメントを表示
Hey guysss,
So I am trying to write a for loop to automatically detrend my signal until the "constant" value, or 0. I am using an updated detrend function that allows for higher order detrending rather than just linear.
%Detrend
Order.Max = 5;
X = 0:Order.Max - 1;
X = sort(X,'descend');
T1.Prc = detrend(T1.Sig1,Order.Max);
T2.Prc = detrend(T2.Sig1,Order.Max);
T3.Prc = detrend(T3.Sig1,Order.Max);
T4.Prc = detrend(T4.Sig1,Order.Max);
T5.Prc = detrend(T5.Sig1,Order.Max);
for Order.Low = X,
T1.Prc = detrend(T1.Prc,Order.Low);
T2.Prc = detrend(T2.Prc,Order.Low);
T3.Prc = detrend(T3.Prc,Order.Low);
T4.Prc = detrend(T4.Prc,Order.Low);
T5.Prc = detrend(T5.Prc,Order.Low);
end
I keep getting this error: ??? Error: File: fieldanalysisPART1.m Line: 18 Column: 10 Unexpected MATLAB operator.
Can you help me correct this? I essentially want the for loop to detrend the original signal T1.Sig1 with the highest order (for example, Order.Max = 5) and save it to T1.Prc. Then, I want the for loop to detrend T1.Prc with 4,3,2,1, and 0.
0 件のコメント
採用された回答
David Young
2011 年 10 月 13 日
It would help if you told us which is line 18, but I'm guessing it's probably the one that says:
for Order.Low = X,
since this will provoke the error message you get.
The reason is that you need to provide a simple variable name for the for-loop. You should try replacing the line above with these two lines:
for x = X
Order.Low = x;
(omitting also the extraneous comma). There may be other problems, but that will at least deal with the message you're getting now.
As a side point, instead of
X = 0:Order.Max-1;
X = sort(X, 'descend');
you could write
X = Order.Max-1 : -1 : 0;
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!