フィルターのクリア

How to define a for loop for given FINDPEAKS problem ?

3 ビュー (過去 30 日間)
YQ
YQ 2024 年 2 月 24 日
コメント済み: Dyuman Joshi 2024 年 2 月 29 日
[A1,L] = findpeaks(A(:,1));
A1(:,2) = A(L,2);
[A2,L1] = findpeaks(A1(:,1));
A2(:,2) = A1(L1,2);
[A3,L2] = findpeaks(A2(:,1));
A3(:,2) = A2(L2,2);
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2024 年 2 月 24 日
編集済み: Dyuman Joshi 2024 年 2 月 24 日
What exactly are you trying to do here?
YQ
YQ 2024 年 2 月 24 日
Actually the matrix A comprises of two columns. 1st column contains acceleration (dependent variable) and the 2nd column is associated time-period (Variable).
The whole code isattached herewith.

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

採用された回答

Dyuman Joshi
Dyuman Joshi 2024 年 2 月 24 日
Try this -
n=3;
B = [num2cell(A,1); cell(n,2)]
for k=2:n
[B{k,1}, L] = findpeaks(B{k-1,1});
B{k,2} = B{k-1,2}(L);
end
Here 1st row of B corresponds to A, 2nd to A1, 3rd to A2 and 4th to A3.
Use indexing to access the data.
  7 件のコメント
YQ
YQ 2024 年 2 月 28 日
it is giving error, "Unrecognized function or variable 'd'.
Error in Chamoli1991VDC02 (line 6)
num = numel(d);"
Let me share you the .dat file so that you can recheck from your end. By the way, thanks a lot man!!
Dyuman Joshi
Dyuman Joshi 2024 年 2 月 29 日
Ah, that's a typo. My bad.
To correct it, replace
num = numel(d);
with
num = numel(data);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by