Error using quiver The size of Y must match the size of U or the number of rows of U.
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Alvaro Mª Zumalacarregui Delgado
am 21 Feb. 2021
Kommentiert: Alvaro Mª Zumalacarregui Delgado
am 21 Feb. 2021
i am trying to create a vector field with app designer with the function quiver but i have an error 'Error using quiver
The size of Y must match the size of U or the number of rows of U.'
a = app.a.Value;
b = app.b.Value;
x1=0;
x2=2;
y1=0;
y2=2;
N = 20;
x = linspace(x1,x2,N);
y = linspace(y1,y2,N);
[X,Y]= meshgrid(x,y);
m = a.*y/b.*x;
S = atan (m);
U = cos (S);
V = sin (S);
quiver (app.Axes, X,Y,U,V);
0 Kommentare
Akzeptierte Antwort
KALYAN ACHARJYA
am 21 Feb. 2021
Bearbeitet: KALYAN ACHARJYA
am 21 Feb. 2021
Refer the MATLAB Docs, where U and V must be 2D as same sizes of X and Y. Please add the following line, this may allow to avoid the error
[U,V]=meshgrid(U,V);
2 Kommentare
KALYAN ACHARJYA
am 21 Feb. 2021
Bearbeitet: KALYAN ACHARJYA
am 21 Feb. 2021
I have tried with non App case (Assigning the value a and b directly)
a = 2;
b= 3;
x1=0;
x2=2;
y1=0;
y2=2;
N = 20;
x = linspace(x1,x2,N);
y = linspace(y1,y2,N);
[X,Y]= meshgrid(x,y);
m = a.*y/b.*x;
S = atan (m);
U = cos (S);
V = sin (S);
[U,V]=meshgrid(U,V);
quiver (X,Y,U,V);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/526354/image.png)
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Vector Fields finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!