Error using Contour: input arguments must be numeric or objects which can be converted to a double
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sergio Manzetti
el 22 de Jun. de 2021
Respondida: Sergio Manzetti
el 24 de Jun. de 2021
Hi, I have the given code where I try to plot levels curves of the givenfunction
syms r x y k z
[ph,r] = meshgrid((0:5:360)*pi/180,0:.5:10);
[X,Y] = pol2cart(ph,r);
Z = X+i*Y;
J = besselj(k,l.*r);
J2 = besselj(k,m.*r);
Y = bessely(k,l.*r);
Y2 = bessely(k,m.*r);
H = besselh(k,r);
F1 = symsum((J).*exp(1i*k*ph),k,-5,5);
F2 = symsum((J2+Y2).*exp(1i.*k.*ph),k,-5,5);
F3 = symsum(H.*exp(1i.*k.*ph),k,-5,5);
pwu = nan(size(F1), 'like', F1);
mask = 0 <= r & r < 0.5;
pwu(mask) = F1(mask);
mask = 0.5 <= r & r < 1;
pwu(mask) = F2(mask);
mask = r >= 1;
pwu(mask) = F3(mask);
U = subs(pwu, {l, m}, {1.5, 3});hold on
contour(X,Y,imag(double(U)),30)
axis equal
xlabel('r','FontSize',14);
ylabel('phi','FontSize',14);
But I get an error for the 4th last line. How can this be made in a way it is converted to a double?
Thanks!
1 comentario
Asvin Kumar
el 24 de Jun. de 2021
I'm not able to run this script because the variables l, m, n, etc are not defined. Could you update the attached code so that your error can be reproduced?
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!