I don't see differences between… but – maybe @fun is more wide than inline-function
>> a
a =
1
>> x=1:10
x =
1 2 3 4 5 6 7 8 9 10
>> y=@(x) x.^a
y =
@(x)x.^a
>> y(x)
ans =
1 2 3 4 5 6 7 8 9 10
>> a=3
a =
3
>> y(x)
ans =
1 2 3 4 5 6 7 8 9 10
>> z=inline('x.^a','x')
z =
Inline function: z(x) = x.^a
>> z(x)
??? Error using ==> inlineeval at 15 Error in inline expression ==> x.^a Undefined function or variable 'a'.
Best Answer