Continuous Graph in a loop

조회 수: 1 (최근 30일)
Nick Sharma
Nick Sharma 2019년 6월 14일
댓글: Nick Sharma 2019년 6월 14일
Hi
My code is as below
i=0:1:10;
x=1;
if i<=3
B=3+x;
else
B=x;
plot(i,B,'*')
hold on
end
================
First of all my graph is not matching my expected result.
Secondly in my expected graph I want continuos line .
Please help .

채택된 답변

Walter Roberson
Walter Roberson 2019년 6월 14일
i = 0:1:10;
x = 1;
B = x * ones(size(i));
mask = i <= 3;
B(mask) = i(mask) + 2;
plot(i, B,'-*')
  댓글 수: 1
Nick Sharma
Nick Sharma 2019년 6월 14일
Walter .....You are a Gem of a person ......thans bro.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by