MATLAB Answers


Undefined operator '+' for input arguments of type 'function_handle'.

Asked by STPG
on 29 Mar 2019
Latest activity Commented on by Adam
on 29 Mar 2019
t1 ...
phi= pi./2;
k = -phi./(t2a(1)-t1(1));
U1 = (exp(1i*pi));
A1= V1 + U_in1 ; % this works ;
U2 = @(t) (exp(1i*(phi + k.*(t-t1(1)))));
A2 = V2a + @(t) U2(t) ; % how to correct this?
A =[A1; A2]
(t, A)


Sign in to comment.

1 Answer

Answer by Adam
on 29 Mar 2019

A2 = V2a + U2(t) ;
would be a function call. You only use the @(t) when defining a function handle, not when actually calling it.


Hi, thanks for your response, I tried that earlier; it triggers another error - Matrix dimensions must agree.
Well, that's a different matter entirely, but it is still the syntactically correct way to call the function.

Sign in to comment.