Clear Filters
Clear Filters

Looking to flip plot

3 views (last 30 days)
Ethan Rando
Ethan Rando on 17 Nov 2020
Answered: Adam Danz on 17 Nov 2020
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');

Answers (1)

Adam Danz
Adam Danz on 17 Nov 2020
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

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!