Looking to flip plot

3 次查看(过去 30 天)
Ethan Rando
Ethan Rando 2020-11-17
回答: Adam Danz 2020-11-17
Hello I am looking to make this plot accurate. For some reason it is spiraling clockwise when it should be spiraling counter clockwise with the same shape. Any help with this would be great.
It is basically flipped on both the x and y-axis from how it should be.
[x, y] = meshgrid(-2.5:.5:2.5, -2.5:.5:2.5);
xdot = (-1*x) + (2*y);
ydot = (-1*x) + (-3*y);
figure(1)
streamslice(x,y, xdot, ydot, 'black')
grid on
xlabel('X');
ylabel('Y');
title('#2');

回答(1 个)

Adam Danz
Adam Danz 2020-11-17
Flip the xdot, ydot vectors and their sign
[x, y] = meshgrid(-2.5:.5:2.5, -2.5:.5:2.5);
xdot = (-1*x) + (2*y);
ydot = (-1*x) + (-3*y);
xdot = -fliplr(xdot); % <----
ydot = -flipud(ydot); % <----
figure(1)
streamslice(x,y, xdot, ydot, 'black')
grid on
xlabel('X');
ylabel('Y');
title('#2');
axis tight

类别

Help CenterFile Exchange 中查找有关 Operators and Elementary Operations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by