For/While/If loop question
古いコメントを表示
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 件のコメント
Jan
2018 年 11 月 28 日
@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.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Code Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
