How to debug this type of error ??
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Manas Ranjan Pattnayak
le 20 Sep 2017
Commenté : Walter Roberson
le 20 Sep 2017
d_p = 0.8;
d_b = 3.9;
c_b = 4.39;
l = 10.6;
n_t=6;
n_z=1;
nt = 400;
nz = 300;
i_c = 1.2;
x_1 = l-d_p-(d_b/2)-c_b;
x_2 = x_1-l;
xs=linspace(0,2*pi*r/n_t,nt/n_t);
y=linspace(x_2,x_1,nz/n_z);
[XS,Y]=meshgrid(xs,y);
I_1 = XS.^2 + Y.^2 - (i_c/2)^2;
I_2 =(XS-(pi*r/(n_t/2))).^2 + (Y).^2 - (i_c/2)^2;
F = I_1 <0 | I_2<0;
FF=repmat (F,n_z,n_t);
[nz,ntn]=size(FF);
x = linspace(0,2*pi*r,ntn);
[X,Y]=meshgrid(x,y);
mesh(x,y,FF)
ERROR:
Error using matlab.graphics.chart.primitive.Surface/set
While setting the 'ZData' property of 'Surface':
Value must be a scalar, vector or array of numeric type
Error in matlab.graphics.chart.internal.ctorHelper (line 6)
set(obj, pvpairs{:});
Error in matlab.graphics.chart.primitive.Surface
Error in mesh (line 133)
hh =
matlab.graphics.chart.primitive.Surface('XData',x,'YData',y,'ZData',z,...
Error in Untitled (line 23)
mesh(x,y,FF)
0 commentaires
Réponse acceptée
Walter Roberson
le 20 Sep 2017
Your FF is type logical not numeric. You can double(FF)
But I have to wonder... Your FF is already an array and then you repmat in both horizontal and vertical direction. The reason for that is not obvious.
3 commentaires
Walter Roberson
le 20 Sep 2017
F is logical, and when you repmat() logical you get something that is logical, so FF is logical. surf() does not accept logical.
F is logical because it is the result of the logical operations < and |
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!