using solve, 4eqs 4unkns

2 views (last 30 days)
Corey Tucker
Corey Tucker on 30 Sep 2020
Answered: Alan Stevens on 1 Oct 2020
I'm trying to understand why the output of the following is giving me a 4x1 matrix for the desired solutions. There should only be one discrete value for a1, a2, p1, p2.
t=0;
syms a1 a2 p1 p2
x1=(-1/3)+a1*(1/3)*sin(sqrt(2)*t+p1)-a2*(1/3)*sin(2*t+p2);
x2=-1+a1*sin(sqrt(2)*t+p1)+a2*sin(2*t+p2);
v1=a1*(1/3)*sqrt(2)*cos(sqrt(2)*t+p1)-a2*(1/3)*2*cos(2*t+p2);
v2=a1*sqrt(2)*cos(sqrt(2)*t+p1)+a2*2*cos(2*t+p2);
soln=solve(x1,x2,v1,v2);
soln.a1
soln.a2
soln.p1
soln.p2
I have found the solutions by other means which are a1=1, a2=0, p1=pi/2, p2=pi/2. The answers matlab is returning is:
ans =
-1
1
-1
1
ans =
0
0
0
0
ans =
-pi/2
pi/2
-pi/2
pi/2
ans =
pi
pi
0
0
Any help would be appreciated.
TY

Answers (1)

Alan Stevens
Alan Stevens on 1 Oct 2020
There are, in fact, an infinite number of possible solutions. When t = 0 the equations can be written and manipulated as follows:
Matlab clearly just provides four simple possibilities!

Tags

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!