When I run my code, I keep getting this error: "The following error occurred converting from sym to double: Unable to convert expression into double array."

I am not an expert at Matlab. Does anyone know what has caused this?

CODE

`function [F,U] = Force4(q,Pars)syms x y x1 y1 x2 y2q=[x;y];Pars.q1=[x1;y1];Pars.q2=[x2;y2];r1=norm(q-Pars.q1);r2=norm(q-Pars.q2);U= -Pars.gamma/r1 - Pars.gamma/r2;F= -1*[diff(U,x), diff(U,y)]';U=subs(U,{x;y},{q(1);q(2)});F=subs(F,{x;y},{q(1);q(2)});`

## Best Answer