Filter löschen
Filter löschen

how do I swap both axes in the current plot

71 Ansichten (letzte 30 Tage)
Jagadeesh Korukonda
Jagadeesh Korukonda am 5 Aug. 2022
Beantwortet: Les Beckham am 5 Aug. 2022
I have symbollic function, I'm plotting that function using fplot
syms y
U = y^2/2 - (3*y)/4;
yrange = [0,1];
fplot(U,yrange)
so i want to swap both axis in the plot, which means my yrange is in y-axis and U in x-axis?

Akzeptierte Antwort

Les Beckham
Les Beckham am 5 Aug. 2022
syms y
U = y^2/2 - (3*y)/4;
yrange = [0,1];
fp = fplot(U,yrange);
plot(fp.YData,fp.XData)
grid on

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 5 Aug. 2022
You have three options:
  • you can solve U for y, taking caution because it will be multi-valued
  • you can use hg transform group and a rotation matrix to rotate the plot
  • you can use view() to change the camera angle

Kategorien

Mehr zu Get Started with Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by