2个回答
展开全部
可以利用max函数获取最值的位置。
如果是极值,可以通过微分来做。比如:
%
by
lyqmath
%
dlut
school
of
mathematical
sciences
%
blog:
http://blog.csdn.net/lyqmath
%
有一组数据,matlab怎样取得每个波峰波谷的数据
clc;
close
all;
clear;
data=[105.03
99.18
84.965
72.445
68.994
77.265...
91.052
100.61
98.215
86.363
74.439
71.625...
80.061
92.18
97.823
91.483
80.241
73.616...
78.547
89.084
94.924
89.689
79.898
75.485...
81.544
89.485
90.578
83.712
77.401
80.18...
86.904
88.721
83.468
78.971
81.983
86.25...
85.224
80.901
80.808
84.488];
indmin=find(diff(sign(diff(data)))>0)+1;
indmax=find(diff(sign(diff(data)))<0)+1;
plot(1:length(data),data);
hold
on;grid
on;
plot(indmin,data(indmin),'r^')
plot(indmax,data(indmax),'k*')
legend('曲线','波谷点','波峰点')
如果是极值,可以通过微分来做。比如:
%
by
lyqmath
%
dlut
school
of
mathematical
sciences
%
blog:
http://blog.csdn.net/lyqmath
%
有一组数据,matlab怎样取得每个波峰波谷的数据
clc;
close
all;
clear;
data=[105.03
99.18
84.965
72.445
68.994
77.265...
91.052
100.61
98.215
86.363
74.439
71.625...
80.061
92.18
97.823
91.483
80.241
73.616...
78.547
89.084
94.924
89.689
79.898
75.485...
81.544
89.485
90.578
83.712
77.401
80.18...
86.904
88.721
83.468
78.971
81.983
86.25...
85.224
80.901
80.808
84.488];
indmin=find(diff(sign(diff(data)))>0)+1;
indmax=find(diff(sign(diff(data)))<0)+1;
plot(1:length(data),data);
hold
on;grid
on;
plot(indmin,data(indmin),'r^')
plot(indmax,data(indmax),'k*')
legend('曲线','波谷点','波峰点')
展开全部
% by dynamic of Matlab技术论坛
% see also http://www.matlabsky.com
% contact me matlabsky@gmail.com
% 2010-02-28 14:06:18
%
syms x
y=x*sin(x) ;
dy=diff(y);% 一阶导数
d2y=diff(dy);%二阶导数
x1=double(solve(dy));% 找出导数为0的点,就是极点
x2=subs(d2y,x1)
% 如果一阶导数为零,二阶导数小于零,则为极大点
x1(x2<0)
% see also http://www.matlabsky.com
% contact me matlabsky@gmail.com
% 2010-02-28 14:06:18
%
syms x
y=x*sin(x) ;
dy=diff(y);% 一阶导数
d2y=diff(dy);%二阶导数
x1=double(solve(dy));% 找出导数为0的点,就是极点
x2=subs(d2y,x1)
% 如果一阶导数为零,二阶导数小于零,则为极大点
x1(x2<0)
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |