Help with the following error with quiver
Mostrar comentarios más antiguos

I am getting the above error using the function quiver for vector field
x = -4e-7:0.1e-12:4e-7;
y = -4e-7:0.1e-12:4e-7;
[X,Y] = meshgrid(x,y);
HX = (atan(((g/2 + X)./Y);
HY1 = (cos((g/2 + X).^2 + (Y).^2/(g/2 - X).^2 + (Y).^2));
H = sqrt(HY1.^2 + HX.^2);
quiver(H,X,Y);
5 comentarios
I believe it's likely that there's a missing period in your expression for HY1. Please see below.
g = 10;
x = -4e-7:0.1e-7:4e-7;
y = -4e-7:0.1e-7:4e-7;
[X,Y] = meshgrid(x,y);
HX = (1/pi)*(atan(((g/2 + X)./Y) + atan((g/2 - X)./Y)));
HY1 = (-1/2*pi)*(log((g/2 + X).^2 + (Y).^2./(g/2 - X).^2 + (Y).^2));
% You probably should have this . here ^
H = sqrt(HY1.^2 + HX.^2);
quiver(X,Y,HX,HY1); % ?
Walter Roberson
el 24 de Mzo. de 2022
You need to resolve H into horizontal and vertical components, and pass quiver(X, Y, horizontal, vertical)
Your current H looks like a pure magnitude.
Rena Berman
el 8 de Abr. de 2022
(Answers Dev) Restored edit
Rik
el 24 de Mayo de 2022
Editing away your question is very rude, please don't do it again.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 24 de Mzo. de 2022
0 votos
quiver has a few calling sequences:
- quiver(x, y, u, v)
- quiver(u, v)
- either of those followed by a scale factor
- any of the above proceeded by an axes handle
You are using three parameters, so you are either using axes, u, v or else u, v, scale. But the first parameter is not an axes so you are using u,v, scale
Did you possibly intend to use quiver3?
Categorías
Más información sobre Vector Fields en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


