plotting two parametric functions in same figure
조회 수: 3 (최근 30일)
이전 댓글 표시
I was trying to plot a parametric function, and its inverse, like this:
t= linspace (-30, +30);
x= t;
y= (t.^5) + t + 1;
plot(x,y)
hold on
% t= linspace (-30, +30); <-- no difference
xx= (t.^5) + t + 1;
yy= t;
plot(xx,yy)
but this gives an empty plot, just showing axes with a far larger range than -30:30
what would I be doing wrong?
regards,D.
댓글 수: 0
채택된 답변
추가 답변 (1개)
Star Strider
2019년 10월 6일
You are not doing anything wrong, you are simply misinterpreting the results. The first function would plot with ‘t’ on the x-axis, going from (-30,30). The second function does the reverse of this, and so the plot adapts to the largest range on both axes, going from
to
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241346/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241347/image.png)
(Also, the plot is not empty when I plot it.)
댓글 수: 2
Star Strider
2019년 10월 6일
Danny Van Elsen‘s Answer moved here —
thank you for your response!
but my output is consistently empty:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241352/image.png)
I get the expected result when entering either of the two functions alone, but nothing when entering both?
regards, D.
Star Strider
2019년 10월 6일
My pleasure!
It is not empty. It shows the two functions crossing each other. The lines are not the plot axes. The blue line is the plot of (x,y), and the red line is the plot of (xx,yy).
참고 항목
카테고리
Help Center 및 File Exchange에서 Two y-axis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!