Info
此问题已关闭。 请重新打开它进行编辑或回答。
Hello I was trying to plot using the following code but i get this error. Can someone help me please? Thank You
1 次查看(过去 30 天)
显示 更早的评论
clc;
clear;
close all;
qc=pi/.15;
delta=0.01;
[X,Y] = meshgrid(0:0.1:1,0:0.1:1);
for alpha=[0.3,0.5,0.7]
for(i=1:11)
syms q ;
A=(q^2*coth(q))/(((1+q^2*(X(i))^2/(2*alpha)))^(1+alpha));
B=(q^2*coth(q))/(((1+q^2*(Y(i))^2/(2*alpha)))^(1+alpha));
ASK1=int(A,0,qc);
ASK2=int(B,0,qc);
Z(i)=(1+(delta)^2*X(i)^2*ASK1)+((delta)^2*Y(i)^2*ASK2);
end
hold on;
surf(X,Y,Z)
end
z must be a matrix not a scalar or vector
1 个评论
Rik
2018-8-26
The error is self-explanatory: the surf function requires a matrix as a third input, not a symbolic vector. Also, your Z vector has only 11 elements, while the grid you're trying to plot to is 11 by 11.
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!