Kiote
Kiote

Reputation: 1

Using MATLAB's solve function to find solution to system of equations

I am having trouble solving a system of equations. I have three equations with a known solution and three unknowns in each equation. However, when I use the solve function in MATLAB, it returns with the error that I have six equations and three variables.

A snippet of my code:

syms V0 T0 X0
A=(g*X0/(2*V0^2*cos(T0)^2)-tan(T0))==a;
B=(tan(T0)-g*X0/(V0^2*cos(T0)^2))==b;
C=(-g/(2*V0^2*cos(T0)^2))==c;

soln=solve([A,B,C],[V0,T0,X0]);

I have already calculated scalar values for a, b, and c. g is a constant. I am not sure why it is returning that I have six equations.

Upvotes: 0

Views: 407

Answers (1)

Maertin
Maertin

Reputation: 384

V0^2 means its a quadratic equation. You could solve for V0^2 as a variable. Set V0^2 = J0 and solve for J0 instead.

soln=solve([A,B,C],[J0,T0,X0]);

Then its three linear equations with three variables.

Once you get value of J0, then you need to solve for V0^2 = J0.

Upvotes: 0

Related Questions