hold on does not work

조회 수: 18 (최근 30일)
Albin Malmqvist
Albin Malmqvist 2020년 9월 14일
댓글: Vivek Anand 2022년 5월 30일
Hello, I've been started learning matlab recently and I've ran into problem regarding the software I think. I've been taught that the hold on command should allow me to plot different graphs in the same figure but i doesn't work for me. When I run hold on it just creates a new figure with the old graph removed and when I plot a new one the old one is still gone. When I asked my teacher he said that's not how it should work. I re-installed the program but the problem is still there, do you know why?
How i write the code:
>> x1 = linspace((-2), 2, 300);
>> y1 = 2 + (x1.^2);
>> plot(x1, y1)
>> hold on
>> x2 = linspace((-2), 2, 5);
>> y2 = 2 + (x2.^2);
>> plot(x2, y2)
When I write hold on x1, y2 disappear and the code ends with only plotting x2, y2.
  댓글 수: 1
Vivek Anand
Vivek Anand 2022년 5월 30일
Hi , I'm facing the same issue. Could you please tell how you resolved it?

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

채택된 답변

Albin Malmqvist
Albin Malmqvist 2020년 9월 16일
Hello everybody, it works now, thanks for your help!
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 9월 16일
What turned out to be the problem?

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

추가 답변 (2개)

Walter Roberson
Walter Roberson 2020년 9월 14일
A small number of people have reported similar situations. If I recall correctly, for most of them the cure was update their graphics drivers; but I seem to recall that a few people had to switch to
opengl software
  댓글 수: 2
Albin Malmqvist
Albin Malmqvist 2020년 9월 14일
Ok will try it, thanks.
Albin Malmqvist
Albin Malmqvist 2020년 9월 14일
Still doesn't work...

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


Steven Lord
Steven Lord 2020년 9월 14일
Can you confirm that you're calling the hold function included in MATLAB and not a different hold.m that you've written and/or downloaded?
which -all hold

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by