Z must be a matrix, not a scalar or vector.

2 次查看(过去 30 天)
really don't understand this "." syntax stuff
my code
d = 0:1:10;
g = 0:1:10;
t = 1;
k=0.7;
[D,G] = meshgrid(d,g);
Z = (4.*d.*k.*g.^((k-4)./k).*(k-1).*(3.*g.^(1./k).*(g.^(1./k)-2.*t.^2.*(3.*k-3))+24.*t.^4+4.*k.*(k.^(2)-5).*t.^4))./(2.*d.*k.*(g.^(1./k)-2.*t.^2.*(k-1)).*g.^((k-2)./k)).^2;
surf(D,G,Z)
does not work, probably because im missing a '.' or have put to many in.
what am I doing wrong?
  1 个评论
Jan
Jan 2011-5-3
Please insert spaces in your code. Can you provide any details about what "does not work" mean? Do you get an error message - if so, which one? Or do the results differ from you expectations?

请先登录,再进行评论。

采纳的回答

Patrick Kalita
Patrick Kalita 2011-5-3
Your computation is done entirely with d and g which are vectors. Hence your output is a vector.
Perhaps you meant to use D and G -- which are matrices -- in your computation of Z?

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by