matlab中m文件里自定义的函数的ezplot绘图
问题:???Errorusing==>mtimesInnermatrixdimensionsmustagree.Errorin==>myf2at10为什么?该怎么改呢?十...
问题:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> myf2 at 10
为什么?该怎么改呢?十分感谢,有悬赏。
m文件,命名是myf2.m
function f = myf2(x,y);
global A;
global B;
global C;
global D;
global H1;
global H2;
global P1;
global P2;
f=(2*A+2*B+D)*x+2.7*A*(H2*exp(-P1*(x+y))+H1*exp(-P2*(x+y)))+3*C*exp(-P1*x)/P1+1.5*A*(x+y+(exp(-P1*(x+y))-1)/P1)+B*(x+(exp(-P1*x)-1)/P1)+(B+D)*(1-exp(-P2*x)*(P1*x+1))/P2+3.5*A*y;
窗口:
global A;
global B;
global C;
global D;
global H1;
global H2;
global P1;
global P2;
A=119; B=117; C=3201; D=3201;
>> H1=20;H2=60;
>> P1=0.72;P2=0.60;
x=0:0.1:20;
>> y=0:0.1:10;
>> [xx,yy]=meshgrid(x,y);
>> mesh(xx,yy,myf2(xx,yy))
grid on 展开
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> myf2 at 10
为什么?该怎么改呢?十分感谢,有悬赏。
m文件,命名是myf2.m
function f = myf2(x,y);
global A;
global B;
global C;
global D;
global H1;
global H2;
global P1;
global P2;
f=(2*A+2*B+D)*x+2.7*A*(H2*exp(-P1*(x+y))+H1*exp(-P2*(x+y)))+3*C*exp(-P1*x)/P1+1.5*A*(x+y+(exp(-P1*(x+y))-1)/P1)+B*(x+(exp(-P1*x)-1)/P1)+(B+D)*(1-exp(-P2*x)*(P1*x+1))/P2+3.5*A*y;
窗口:
global A;
global B;
global C;
global D;
global H1;
global H2;
global P1;
global P2;
A=119; B=117; C=3201; D=3201;
>> H1=20;H2=60;
>> P1=0.72;P2=0.60;
x=0:0.1:20;
>> y=0:0.1:10;
>> [xx,yy]=meshgrid(x,y);
>> mesh(xx,yy,myf2(xx,yy))
grid on 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询