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개)
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!