作业帮 > 综合 > 作业

matlab高手帮忙看程序!

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/04/30 08:54:05
matlab高手帮忙看程序!
我要画matlab图,f 随x,y变化,怎么不会出现图形呢,程序如下,请大师帮忙看程序哪里出错了,
clc
x=0:0.2:10;
y=x;
f=x.^5.*y.^5.*0.1.^(y-1).*0.3.^(y-1).*0.5.^(y-1).*0.8.^(y-1).*0.9.^(y-1).*exp(-x.*(0.1.^y+0.3.^y+0.5.^y+0.8.^y+0.9.^y));
surf(x,y,f);
surf(Z) creates a a three-dimensional shaded surface from the z components in matrix Z, using x = 1:n and y = 1:m, where [m,n] = size(Z). The height, Z, is a single-valued function defined over a geometrically rectangular grid. Z specifies the color data as well as surface height, so color is proportional to surface height.
意思是说Z的维数应该是x和y的联合维数
刚才执行了你的这段代码,x y f的维数都是1X51的,建议你先查f这个函数书写是否有问题
再问: 函数 f 就是上面的函数,f=x^5*y^5*0.1^(y-1)*0.3^(y-1)*0.5^(y-1)*0.8^(y-1)*0.9^(y-1)*exp(-x*(0.1^y+0.3^y+0.5^y+0.8^y+0.9^y))。编程序时需要点乘,上面的处理不知道对错,希望帮忙指点,给出正确的 f 在程序中的表达,谢谢!
再答: 表达式没错,执行后直接调用 plot3(x,y,f) 希望是你要的结果