MATLAB Matlab Loop Help for x = 1:15 | Troubleshooting and Plotting

  • Thread starter Thread starter j-lee00
  • Start date Start date
  • Tags Tags
    Loop Matlab
j-lee00
Messages
93
Reaction score
0
for x = 1:15

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 doesn't this work?
 
Physics news on Phys.org
no equal signs, you are leaving out 5, 10 and 15 right off the bat.
 

Similar threads

Back
Top