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

10 visualizzazioni (ultimi 30 giorni)
cesow
cesow il 16 Nov 2022
Risposto: devest il 16 Nov 2022
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 ]
就得到这个???怎么回事啊~~求大神帮忙看看

Risposta accettata

devest
devest il 16 Nov 2022
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]

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!