I need to write a code for if x>a then calculate (x-a)^n, if x<=a output 0. I figure my initial issues were that since x can be scalar OR VECTOR then i had to adapt the code for that. I am having issues picking each element from vector x.
My code so far
x=input('enter "x" as a vector [a b] or variable: ');
n=input('enter "n" parameter: ');
a=input('enter "a" parameter: ');
I get 27. Which is just the correct answer for 5. When x=0 it should be giving me 0 obviously which it is not.
Added attachment of the piecewise function I am trying to make.