필터 지우기
필터 지우기

How to create multiple graphs based on a variable that goes into a for-loop?

조회 수: 1 (최근 30일)
Hello Community,
I want to plot multiple graphs into one figure.
The multiple graphs are based on different geometry inputs, i.e. 4 graphs needed for 4 different
The different geometry inputs are used in a loop for B:
I can find the result for every single geometry input, which is fine:
How can I create several graphs for several geometry inputs at the same time?
Thank you very much
  댓글 수: 2
GettinStarted
GettinStarted 2020년 6월 27일
Hi Vladimir,
thank you for the quick answer.
I know the "hold" command, but I guess this would mean, that I have to create new loops for every different geometry input. So if I want to plot 4 graphs for 4 different geometry inputs this would need 4 loops at the same time.
Is there a more elegant way to do it?

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

채택된 답변

darova
darova 2020년 6월 28일
Maybe you need only one more for loop
expansion = [1 2 3 4];
x = 0:10;
% data
for k = 1:length(expansion)
y = sin(x)*expansion(k);
line(x,y)
end
  댓글 수: 3
GettinStarted
GettinStarted 2020년 6월 29일
Hello davora,
thank you very much for your help.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by