matlab怎么求曲线最大值x=0:0.01:pi*2;i=5.515*0.045*(1480*pi/30)^2*(cos(x)+0.2*cos(2*x));plot(x,i)hold onx=0:0.01:pi*2;f=(-pi*0.11*0.11*530000*(0.09*0.09./(0.09*0.09+0.045*1.05-0.045*cos(x)-0.045*0.05*cos(2*x))).^1.3).*(x>=0&x=0.977&x=pi&x=5.37
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 08:19:26
matlab怎么求曲线最大值x=0:0.01:pi*2;i=5.515*0.045*(1480*pi/30)^2*(cos(x)+0.2*cos(2*x));plot(x,i)hold onx=0:0.01:pi*2;f=(-pi*0.11*0.11*530000*(0.09*0.09./(0.09*0.09+0.045*1.05-0.045*cos(x)-0.045*0.05*cos(2*x))).^1.3).*(x>=0&x=0.977&x=pi&x=5.37
matlab怎么求曲线最大值
x=0:0.01:pi*2;
i=5.515*0.045*(1480*pi/30)^2*(cos(x)+0.2*cos(2*x));
plot(x,i)
hold on
x=0:0.01:pi*2;
f=(-pi*0.11*0.11*530000*(0.09*0.09./(0.09*0.09+0.045*1.05-0.045*cos(x)-0.045*0.05*cos(2*x))).^1.3).*(x>=0&x=0.977&x=pi&x=5.372&x=0&x=3&x=3.28&x
是找出z的最大最小值
matlab怎么求曲线最大值x=0:0.01:pi*2;i=5.515*0.045*(1480*pi/30)^2*(cos(x)+0.2*cos(2*x));plot(x,i)hold onx=0:0.01:pi*2;f=(-pi*0.11*0.11*530000*(0.09*0.09./(0.09*0.09+0.045*1.05-0.045*cos(x)-0.045*0.05*cos(2*x))).^1.3).*(x>=0&x=0.977&x=pi&x=5.37
程序改为如下:
x=0:0.01:pi*2;
i=5.515*0.045*(1480*pi/30)^2*(cos(x)+0.2*cos(2*x));
f=(-pi*0.11*0.11*530000*(0.09*0.09./(0.09*0.09+0.045*1.05-0.045*cos(x)-0.045*0.05*cos(2*x))).^1.3).*(x>=0&x<0.977)+(-92500*pi*0.11*0.11).*(x>=0.977&x<pi)+(-pi*0.11*0.11*92500*(1.09*0.09./(0.09*0.09+0.045*1.05-0.045*cos(x)-0.045*0.05*cos(2*x))).^1.4).*(x>=pi&x<5.372)+(-530000*pi*0.11*0.11).*(x>=5.372&x<=2*pi);
g=1030.*(x>=0&x<3)+(-2060/0.28*x+2060/0.28*3.14).*(x>=3&x<3.28)+(-1030).*(x>=3.28&x<=6.28);
z=i+f+g;
ymax=max(z);%求极大值
ymin=min(z);%求极小值
xm=find(diff(sign(diff(z)))==-2)+1;%求极大值坐标
xmax=xm(1)*0.01;%求极大值坐标
xi=find(diff(sign(diff(z)))==2)+1;
xmin=xi(2)*0.01;%求极小值坐标
plot(x,z,xmax,ymax,'r*',xmin,ymin,'r*')
xlabel('x')
ylabel('z')
grid on
text(xmax,ymax,'最大值坐标(0.9300 431.5739)')
text(xmin,ymin,'最小值坐标(5.3900 -1.7765×10^4)')
disp(['最大值坐标(' num2str(xmax) ',' num2str(ymax) ') ' '最小值坐标(' num2str(xmin) ',' num2str(ymin) ')'])
结果:
最大值坐标(0.93,431.5739) 最小值坐标(5.39,-17764.6164)