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 .

 Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Jun. de 2019

1 voto

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

1 comentario

Nick Sharma
Nick Sharma el 14 de Jun. de 2019
Walter .....You are a Gem of a person ......thans bro.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 14 de Jun. de 2019

Comentada:

el 14 de Jun. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by