For/While/If loop question
Mostrar comentarios más antiguos
Hey there I have a range of values from 0-10 and for different ranges there will be different relations for example lets say x=0:10 and when x<3 than x2=x^2+2x and when 3<=x<7 than x2=x^4-x^8+44x and than another relation for the rest i'm wondering how I'd write the loop for it.
This is what I was thinking x=0:10;
while x<.3 x2=x^2+2x end
while 3<=x<7 x2=x^4-x^8+44x end
fprintf('x2')
although maybe a while loop nested in a for loop could work if that makes sense
1 comentario
Jan
el 28 de Nov. de 2018
@David: It is impolite to remove the text of the question, after somebody has spent the time an effort to post an answer. If you proceed to do this, your chances to get answers for your future questions will shrink.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Code Performance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
