Plotting a specific interval for a given matrix

Hi, I have a matrix with several entries on three rows, and I would like to plot the entries of the 2nd and 3d row values towards the 1st row. This is rather easy, and I do:
plot3(P(:,2),P(:,3),P(:,1));
wheree P is the matrix file. However, I would like to restrict the plot on the 1st row (P(:,1) on the interval [-1,1], the 2nd row on [-10,10] and the 3d on [-3Exp^(-16), 3Exp^(-16)]. I tried:
xlim auto; ylim auto; zlim auto
plot3(P(:,2),P(:,3), P(:,1))
or
xlim([-10 10]); ylim([-2.449293598294706e-16 2.449293598294706e-16]); zlim([-1 1])
plot3(P(:,2),P(:,3), P(:,1))
But the plot is not respecting the periods of the three axes.
How can I do that?
Thanks

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2024년 1월 18일
이동: Fangjun Jiang 2024년 1월 18일

0 개 추천

Do you mean to apply xlim(), ylim() and zlim() on the plot?

댓글 수: 9

Sergio
Sergio 2024년 1월 18일
편집: Sergio 2024년 1월 18일
Yes. No existing example on multiple axes usage here https://se.mathworks.com/help/matlab/ref/xlim.html
okay, then applying zlim([-1 1]), etc. would meet your need.
Sergio
Sergio 2024년 1월 18일
I tried, see above.
No need to run "xlim auto". Run xlim() after the plot() command.
Sergio
Sergio 2024년 1월 18일
편집: Sergio 2024년 1월 18일
That didn't work either. A regular plot without any lims works, but it shows its own periods on the three axes.
t = 0:pi/50:10*pi;
st = sin(t);
ct = cos(t);
plot3(st,ct,t)
t = 0:pi/50:10*pi;
st = sin(t);
ct = cos(t);
plot3(st,ct,t)
zlim([10,20])
Sergio
Sergio 2024년 1월 18일
편집: Sergio 2024년 1월 18일
It seems impossible to define the periods on each axis as asked at the top. I just get the same result with the new commands
t= P(:,1);
st = P(:,3);
ct = P(:,2);
plot3(st,ct,t)
zlim([-10,10])
Your P is 3x100, maybe you mean to do plot3(P(2,:),P(3,:), P(1,:))
Sergio
Sergio 2024년 1월 18일
A!!! Thanks Fangjun!!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

릴리스

R2023b

태그

질문:

2024년 1월 18일

댓글:

2024년 1월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by