I need help with this Matlab program. I\'m not sure I am doing this correctly. I
ID: 3348445 • Letter: I
Question
I need help with this Matlab program. I'm not sure I am doing this correctly. I keep getting errors. thanks
File rey (a) Enter the function f(z, y)-a2+ as an inline or anonymous function (see page 6) y+ 1 Evaluate the function at x =-1 and y = 2 by entering f (-1,2) in the command window (b) Type clear f to clear the value of the function from part (a). Now write a function M-file for the function f) Save the fle as f.m (include the M-ile in your report) y + 1 and y - Evaluate the function at 2 by entering f (-1,2) in the command window pg pg pO pg P9 pg 1435 x 291 0,0 1435x291 Internet Explorer 8:06 A 0Explanation / Answer
a)
f = @(x,y)x^2+(x*exp(y))/(y+1);
f(-1,2)
ans =-1.4630
b)Code
function f = f(x,y)
f =x^2+(x*exp(y))/(y+1);
end
SAVE THIS as f in your pc/lap
Then go to command window type f then press enter below will appear
f =
@(x,y)x^2+(x*exp(y))/(y+1)
type f(-1,2)
ans =
-1.4630