for x = 1:15(adsbygoogle = window.adsbygoogle || []).push({});

if x < 5

y = 2*x - 5;

elseif 5 < x <10

y = 4*x;

elseif 10< x <15

y = x*x;

end;

end;

plot(x,y)

Why doesnt this work?

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab loop help

**Physics Forums | Science Articles, Homework Help, Discussion**