Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Stuck on rewriting program to use nested if constructs
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos

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

2 comentarios
Rik
el 12 de Nov. de 2018
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
Respuestas (2)
Torsten
el 12 de Nov. de 2018
if x>=0
if y>=0
...;
else
...;
end
else
if y>=0
...;
else
...;
end
end
0 comentarios
Guillaume
el 12 de Nov. de 2018
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))
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!