how do I swap both axes in the current plot
99 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Les Beckham
2022-8-5
syms y
U = y^2/2 - (3*y)/4;
yrange = [0,1];
fp = fplot(U,yrange);
plot(fp.YData,fp.XData)
grid on
0 个评论
更多回答(1 个)
Walter Roberson
2022-8-5
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!