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!