plot with if else command

6 vues (au cours des 30 derniers jours)
Yingnan Huo
Yingnan Huo le 6 Mar 2019
Commenté : Yingnan Huo le 6 Mar 2019
c=[1 -12 24 -48]
croots=roots(c)
Use the if - elseif construct to plot the 1st root as follows: if
the root is less than 3 or greater than 5, plot the root as red + with
size 32; if the root is greater than 3 and less than 5, plot the root
as a blue square size 32.
  1 commentaire
madhan ravi
madhan ravi le 6 Mar 2019
Please show what you have tried for your homework.

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 6 Mar 2019
Check the demo example.
figure
hold on
for i = 1:10
x = rand ;
if x < 0.5
plot(i,x,'*r')
else
plot(i,x,'*b')
end
end
  1 commentaire
Yingnan Huo
Yingnan Huo le 6 Mar 2019
thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by