Why is the size of the function different in plot3 and quiver3?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Pijush
am 20 Sep. 2017
Kommentiert: Chad Greene
am 20 Sep. 2017
f = 10^8;
x = 0:0.1:5;
c=3*10^8;
z =sin(2*pi*x*f/c+f*x/c);
y =sin(2*pi*x*f/c+f*x/c+pi/2);
o = zeros(size(x));
quiver3(x,o,o,o,z,o,'LineStyle','--');
hold on
quiver3(x,o,o,o,o,y,'LineStyle','--')
hold on
quiver3(x,o,o,o,z,y,'LineStyle','-')
hold on
plot3(x,z,o)
hold on
plot3(x,o,y)
hold on
plot3(x,z,y)
axis square
output:
0 Kommentare
Akzeptierte Antwort
Chad Greene
am 20 Sep. 2017
Bearbeitet: Chad Greene
am 20 Sep. 2017
The quiver and quiver3 functions automatically scale the vectors. To turn off automatic scaling, add a 0 just before setting the 'LineStyle'. That is,
quiver3(x,o,o,o,z,o,0,'LineStyle','--');
hold on
quiver3(x,o,o,o,o,y,0,'LineStyle','--')
quiver3(x,o,o,o,z,y,0,'LineStyle','-')
3 Kommentare
Chad Greene
am 20 Sep. 2017
You can set the relative aspect ratio of a plot with daspect. To make x, y, and z axes all equal just do
daspect([1 1 1])
Weitere Antworten (0)
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!