MATLAB程序运行不出结果
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/07/17 10:15:23
MATLAB程序运行不出结果
v=14;
g=10;
L1=0.6;
L2=0.6;
R = @(x) -(v*sin(x(2))*(g*v*cos(x(2))+sqrt(g^2*v^2^cos(x(2))^2+2*L1*g*sin(x(1))+2*L2*g*sin(x(2)))));
lb = [20; 20]; % x y的下限
ub = [45; 90] ; % x y的上限
x0 = [30;60]; % Starting guess at the solution
[x1,fval1] = fmincon(R,x0,[],[],[],[],lb,ub);
xmax2 = x1(1) % 极值点x的值
ymax2 = x1(2) % 极值点y的值
zmax2 = -fval1 % Z的最大值
这个是源程序
运行后提示
Warning:To use the default trust-region-reflective algorithm you must supply the gradient in the
objective function and set the GradObj option to 'on'.FMINCON will use the active-set algorithm instead.
For information on applicable algorithms,see Choosing the Algorithm in the documentation.
v=14;
g=10;
L1=0.6;
L2=0.6;
R = @(x) -(v*sin(x(2))*(g*v*cos(x(2))+sqrt(g^2*v^2^cos(x(2))^2+2*L1*g*sin(x(1))+2*L2*g*sin(x(2)))));
lb = [20; 20]; % x y的下限
ub = [45; 90] ; % x y的上限
x0 = [30;60]; % Starting guess at the solution
[x1,fval1] = fmincon(R,x0,[],[],[],[],lb,ub);
xmax2 = x1(1) % 极值点x的值
ymax2 = x1(2) % 极值点y的值
zmax2 = -fval1 % Z的最大值
这个是源程序
运行后提示
Warning:To use the default trust-region-reflective algorithm you must supply the gradient in the
objective function and set the GradObj option to 'on'.FMINCON will use the active-set algorithm instead.
For information on applicable algorithms,see Choosing the Algorithm in the documentation.
![MATLAB程序运行不出结果](/uploads/image/z/15587478-54-8.jpg?t=MATLAB%E7%A8%8B%E5%BA%8F%E8%BF%90%E8%A1%8C%E4%B8%8D%E5%87%BA%E7%BB%93%E6%9E%9C)
计算有结果啊!~
xmax2 =
30.0376 + 0.2358i
ymax2 =
63.2612 - 0.1850i
zmax2 =
9.2040e+003 -1.3470e+000i
xmax2 =
30.0376 + 0.2358i
ymax2 =
63.2612 - 0.1850i
zmax2 =
9.2040e+003 -1.3470e+000i
一个LINGO的程序结果运行不出,
帮我看一下这段matlab程序为什么有错误,运行不出图像?
我的MATLAB程序运行这条指令时老是出不了结果 quad('x.*log(1+x)',0,1); 程序根本没有显示结果
层次分析法matlab程序运行后结果怎样理解?
【Matlab程序运行出错】!
matlab程序运行,出错,
MATLAB 响应面法程序为什么运行不出来?
下面的matlab程序错误在哪里?怎么不运行?
求教OLS Matlab程序,看不懂,运行不出来.
C语言程序运行结果选择题:这道题知道怎么算出答案,算了很久都对不上一个答案?
matlab运行结果.
猴子吃桃子问题的程序这个程序哪里有问题?可以运行,但是得不出正确结果1534来,怎么回事啊这个...#include "