フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I have program of following format. I need the plot to be of different colors based on the if statement in program. How do I do it?

2 ビュー (過去 30 日間)
Lakshmikruthiga Ponnusamy
Lakshmikruthiga Ponnusamy 2019 年 1 月 4 日
閉鎖済み: Rik 2019 年 1 月 8 日
iter=1500;
for I=2:iter
function stage1
body //solves 2nd order ODE and gives displacement and velocity//
end function
function stage2
body //solves 2nd order ODE and gives displacement and velocity//
end function
if displacement >0 and velocity<0
execute stage1
else if (condition)
execute stage2
//The condition goes on//
endif
endfor
plot(tim(:),displ(:,1));
Now I want the time vs displ plot to be green for stage1 values and other colors for subsequent stage values.
  2 件のコメント
Jan
Jan 2019 年 1 月 4 日
There is no "end function" and "endfor" in Matlab. Please mention, if you use Octave. The pseudo-code does not allow to suggest a modification. Please post the actual code and ask a specific question.
Rik
Rik 2019 年 1 月 8 日
closed as superseded by later questions

回答 (0 件)

この質問は閉じられています。

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by