Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Hello I was trying to plot using the following code but i get this error. Can someone help me please? Thank You
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Rik
le 26 Août 2018
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.
Réponses (0)
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!