Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Stuck on rewriting program to use nested if constructs
4 ビュー (過去 30 日間)
古いコメントを表示

this is one of my homework problems that I'm currently stuck on. so far I have:

2 件のコメント
Rik
2018 年 11 月 12 日
What are you stuck on? Doesn't this work? What error are you getting? If you don't know how to use fprintf have you read its documentation?
Also note that you made a small typo:
if x>=0
if y>=0 % you have y>0
回答 (2 件)
Torsten
2018 年 11 月 12 日
if x>=0
if y>=0
...;
else
...;
end
else
if y>=0
...;
else
...;
end
end
0 件のコメント
Guillaume
2018 年 11 月 12 日
For reference, one way to do this in matlab without any if at all, in just one line:
fun = x.^(1 + (x<0)) + y.^(1 + (y<0))
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!