如何求一个函数的极大​值点和对应的横坐标啊​!!!!。

9 ビュー (過去 30 日間)
cesow
cesow 2022 年 11 月 16 日
回答済み: devest 2022 年 11 月 16 日
wn=3.4338;zeta=0.14037;wd=wn*sqrt(1-zeta^2);X=0.4550;
t=0:0.01:20;
y=X.*exp(-zeta.*wn.*t).*sin(wd.*t);
怎么求这个函数的所有极大值和横坐标啊。
我用了findpeaks(y)找到了极大值,可是不知道怎么求出来横坐标。
findpeaks(y)
ans =
Columns 1 through 10
0.3678 0.1509 0.0619 0.0254 0.0104 0.0043 0.0018 0.0007 0.0003 0.0001
Column 11
0.0000
我再用解方程的方法
solve('y=0.3678','t')
Warning: Explicit solution could not be found.
> In solve at 169
ans =
[ empty sym ]
就得到这个???怎么回事啊~~求大神帮忙看看

採用された回答

devest
devest 2022 年 11 月 16 日
findpeaks 函数可以直接返回极大值点的索引的,利用该索引去找出横坐标即可
wn=3.4338;zeta=0.14037;wd=wn*sqrt(1-zeta^2);X=0.4550;
t=0:0.01:20;
y=X.*exp(-zeta.*wn.*t).*sin(wd.*t);
[pks,locs] = findpeaks(y);
t(locs)
plot(t,y,'k-',t(locs), y(locs),'ro')
[attach]115925[/attach]

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!