フィルターのクリア

What do these steps do?

1 回表示 (過去 30 日間)
Vineet Patel
Vineet Patel 2018 年 12 月 2 日
回答済み: Walter Roberson 2018 年 12 月 2 日
Hi All,
Can someone tell me what these steps mean/do? And if theres a way of simplifing the code.
xmax = [];
[t,x] = ode45(f,tspan,x0);
n = find(t>60);
x = x(n,:);
n = length(x(:,1));
k = 1;
k = k+1;
j = 1;
for i=2 : n-1
if (x(i-1,1)) < x(i,1) && x(i,1) > (x(i+1,1))
xmax(k,j)=x(i,1);
j=j+1;
end
end
Any help would be great,
Thank you

採用された回答

Walter Roberson
Walter Roberson 2018 年 12 月 2 日
Run an ode45 over tspan. Some but not all of the timesteps correspond to times greater than 60; extract the ode values that were generated for those times.
That done, look for local peaks in the first column.
There are other ways to look for peaks, including vectorized ways. findpeaks() is more flexible about what a peak looks like.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by