登录论坛

查看完整版本 : [MATLAB基础] 求助。求函数的最小x值


overkille
2013-08-08, 18:09
函数如下,试图求出整个函数的最小x值,并画出实数部分图像。先谢过各位。

小弟写的运行不了,
提示:??? Error: "f" was previously used as a variable,conflicting with its use here as the name of a function.

x=sym('x');
y= 6000*(x/14)^3;
z= 160;
s1= 1850;
t1= s1/(24*x);
t2= 2*t1;
t3= t2+2;
m1= 239/t3;
%-------------------------------------------------------------
n1=y*z*10^-6/24;
n2=n1*t1;
n3=m1*n1*t2;
v1=30000;
v2=m1*v1;
%---------------------------------------------------------------
p1=625;
k1=p1*n3;
c1=6000;
k2=c1*240;
b1=5342;
k3=b1*240;
g=0;
%------------------------------------------------------------------
r=10;
f=(k1+k3+g)-v2*r;
f1=(k1+k3+g)/v2;
%------------------------------------------------------------------
x=solve(f,x)
mv=fminsearch(@f,[1.100]);
ezplot(f)