how do I swap both axes in the current plot
조회 수: 64 (최근 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에서 Get Started with Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!