How to plot with incrementally changing variables

조회 수: 8 (최근 30일)
Highwayman2
Highwayman2 2015년 5월 5일
답변: Titus Edelhofer 2015년 5월 5일
How do you plot something where one of the variables being plotted have dozens of variables as it was found using incrementally changing values. I basically have to do a plot of distance that varies depending on an angle theta (distance = tan theta), where theta was found using two formulae whose values changed with incremental changes in 1 variable in those formulas so I have dozens of values of theta which i want to plot all of as the distance changes depending on the angle.
This question extends from one I have asked previously.(<http://www.mathworks.com/matlabcentral/answers/215098-how-do-i-loop-through-incrementally-changing-values#answer_177846>)
Thanks in advance, I appreciate and am greatful everyones help.
  댓글 수: 1
Michael Haderlein
Michael Haderlein 2015년 5월 5일
Maybe I didn't get your question correctly, but how does it matter where your variables come from (as long as their size is equal)? Why does a simple
plot(theta,distance)
not work?

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

채택된 답변

Titus Edelhofer
Titus Edelhofer 2015년 5월 5일
Hi Peter,
when you divide by a vector, you need to switch to pointwise arithmetic instead of matrix "division". So it should be
distance = 1000./theta;
Titus

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by