MATLAB Answers

How to rescale x- axis?

조회 수: 201(최근 30일)
PetronasAMG
PetronasAMG 18 Jan 2018
so when i plot my function, i get a wide graph.
but i need a narrower graph.
I tried to used limx function and I thought i got it, however, when changing the input value, meaning get a different graph that is wider than 15, my graph will cut off due to limx. I could increase the limx interval however, if the input keeps on changing, i cannot use limx. is there a way you can commend Matlab to set auto scale like the bottom graph? so whatever input value i give, it can always adjust scale to become a narrower graph.
(This is what i get when i change my input value)
(This is what I want my graph to look like)

  댓글 수: 0

로그인 to comment.

답변(1개)

David Goodmanson
David Goodmanson 18 Jan 2018
편집: David Goodmanson 18 Jan 2018
Hi Petronas,
If the width of the spiral is proportional to some input value, you can come up with an appropriate constant and use
xlim([-C*input_value, C*input_value])
and if the plot limits need to be some more complicated function of some input value then you can plug that function into the xlim expression.

  댓글 수: 4

표시 이전 댓글 수: 1
PetronasAMG
PetronasAMG 18 Jan 2018
OMG it worked!! Thank you so much!!! Just to make sure so i can really utilize this function next time, what does axis equal exactly do?
Star Strider
Star Strider 18 Jan 2018
As always, my pleasure!
The axis equal call uses the same length for the data units along each axis.
David Goodmanson
David Goodmanson 18 Jan 2018
good one!

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그


Translated by