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

  • Context: MATLAB 
  • Thread starter Thread starter j-lee00
  • Start date Start date
  • Tags Tags
    Loop Matlab
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 7K views
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