I need to plot multiple functions in one plot, in one figure, within a for loop

조회 수: 7 (최근 30일)
I need to plot multiple functions in one plot, in one figure, within a for loop. I've tried putting 'hold on' in a trillion different places in the for loop with no success.
X and Y are defined earlier in the code
X = [0.3, 0.5, 0.7, 2.5];
Y= [2, 4, 6, 8];
  댓글 수: 1
Bob Thompson
Bob Thompson 2020년 3월 5일
For the record, it is better if you paste the code directly, instead of an image. That way we can just copy the text.
What is t?
I suspect that the issue is calling out 'figure' within the loop, which will specify a new figure each loop. Try moving that outside the loop.

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

채택된 답변

darova
darova 2020년 3월 5일
What about figure?

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by