MATLAB: How to solve two nonlinear equations

nonlinearsolvesymbolic

I have two equations:
1: x1+x2=a-b*cos(th)
2: x1^2+x2^2=c-d*cos(th)
where th is the inputvariable; a,b,c,d are constants; and x1 and x2 are the output variables. How can I solve these equations using matlab such that I get two separate symbolic expressions for x1 and x2, as a function of th? Thank you in advance,

Best Answer

syms x1 x2 a b c d th
solve(x1+x2-(a-b*cos(th)), x1^2+x2^2-(c-d*cos(th)),x1,x2)