MATLAB: How to solve this equation

equations

(1+cost)(tcost-sint)=2K(sint^2), where k is a constant

Best Answer

well a quick look at the equation, t=0 is always the solution regardless of the value of K.
However, if you want to solve these numerically you can choose an approach like below:
K=2;
fun=@(t) (1+cos(t)).*(t.*cos(t)-sin(t))-2*K*(sin(t).^2);
% or the following. Not sure which one you want.
% fun=@(t) (1+cos(t)).*(t.*cos(t)-sin(t))-2*K*(sin(t.^2));
Options=optimset(@fsolve);
Options.TolFun=1e-10;
[x,fval,exitflag,output] = fsolve(fun,1,Options)
x =
1.4560e-04
fval =
-8.4804e-08
exitflag =
1
output =
iterations: 12
funcCount: 26
algorithm: 'trust-region-dogleg'
firstorderopt: 9.8791e-11
message: 'Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the selected valu...'