MATLAB Answers

0

Continuous Graph in a loop

Asked by Nick Sharma on 14 Jun 2019
Latest activity Commented on by Nick Sharma on 14 Jun 2019
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 .

  0 Comments

Sign in to comment.

Products

1 Answer

Answer by Walter Roberson
on 14 Jun 2019
 Accepted Answer

i = 0:1:10;
x = 1;
B = x * ones(size(i));
mask = i <= 3;
B(mask) = i(mask) + 2;
plot(i, B,'-*')

  1 Comment

Walter .....You are a Gem of a person ......thans bro.

Sign in to comment.