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 Center および File ExchangeLine Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by