MATLAB: How to solve two simultaneous equations using solve command

solve command

I want to solve these two simultaneous equations:
eqn1 = 0.75*k*B1^3 + 0.75*k*B1*B2^2 - m*w^2*B1 + c*B1 -D*w*B2- A == 0
eqn2 = 0.75*k*B2^3 + 0.75*k*B2*B1^2 - m*w^2*B2 + c*B2 -D*w*B1 == 0
and find what is the (B1^2+B2^2)^(1/2) (square root of B1 squared plus B2 squared ) and also plot the (B1^2+B2^2)^(1/2) Vs w.
So far I wrote my code until here and i dont know how to continue:
syms A m c k w D B1 B2
eqn1 = 0.75*k*B1^3 + 0.75*k*B1*B2^2 - m*w^2*B1 + c*B1 -D*w*B2- A == 0;
eqn2 = 0.75*k*B2^3 + 0.75*k*B2*B1^2 - m*w^2*B2 + c*B2 -D*w*B1 == 0 ;
eqn1 = subs(eqn1, [k,m,c,A,D], [0.2,1,1,1,0.2]);
eqn2 = subs(eqn2, [k,m,c,A,D], [0.2,1,1,1,0.2]);
sol1 = abs(solve(eqn1,B1));
sol2 = abs(solve(eqn2,B2));

Best Answer

[B1sol, B2sol] = solve([eqn1,eqn2],[B1,B2]);
Y = sqrt(B1sol.^2 + B2sol.^2);
fplot(Y)
These involve fifth order polynomials, so there are 5 solutions, and plotting is rather slow.
Unfortunately, the root() operation that is generated symbolically cannot be translated using matlabFunction, so this cannot easily be translated into a numeric function.
Related Question