How do i make multiple conditions for multiple variable
Mostrar comentarios más antiguos
so i have a function for exampe h= help(n,x)
h= 2 * help(n-1,x) + help(n-2,x) which should work only when -3<x<3 and n>=2.
and i want it such that when the conditions isnt fulfilled, disp(error: x is outside intervall) and/or disp(error: n is smaller than 2)
so when only x is wrong, only 'error: x is outside intervall' shows.
when only n is wrong, only 'error: n is smaller than 2' shows.
but if both x and n are wrong, then both statements are shown.
Respuestas (1)
if ~(( x > -3) & (x < 3))
error("Please check the value of x ")
end
if ~(n>=2)
error("Please check the value of n")
end
end
3 comentarios
Raphael Patrik
el 13 de Jun. de 2020
KSSV
el 13 de Jun. de 2020
you are right.....now check..you can extend the code youself.
Raphael Patrik
el 13 de Jun. de 2020
Categorías
Más información sobre Signal Operations 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!