Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Solving system of eqations

Subject: Solving system of eqations

From: Marcus Glover

Date: 15 Jun, 2013 17:44:07

Message: 1 of 4

R=phi1/theta1+phi2/theta2=(k1/k2)*(1+k3/k4)

delta=sqrt(((k2+k3+k4)^2)-4k2*k4)

phi1=k1(theta1-k3-k4)/delta

phi2=k1(theta2-k3-k4)/-delta

theta1=(k2+k3+k4+delta)/2

theta2=(k2+k3+k4-delta)/2

I have numeric values for R, phi1, phi2, theta1, theta2. I am tying to get numeric solutions for k1,k2,k3,k4. I am not sure what the best approach here. I can give bounds to the ks, I know they should be all positive for example.

I have tried using solver but I get a lot of "Explicit solution could not be found." Admittedly, this is my first time trying solver so I could just be taking the wrong path.

Any advice would be greatly appreciated.

Subject: Solving system of eqations

From: Nasser M. Abbasi

Date: 15 Jun, 2013 18:57:44

Message: 2 of 4

On 6/15/2013 12:44 PM, Marcus Glover wrote:
> R=phi1/theta1+phi2/theta2=(k1/k2)*(1+k3/k4)
>
> delta=sqrt(((k2+k3+k4)^2)-4k2*k4)
>
> phi1=k1(theta1-k3-k4)/delta
>
> phi2=k1(theta2-k3-k4)/-delta
>
> theta1=(k2+k3+k4+delta)/2
>
> theta2=(k2+k3+k4-delta)/2
>
> I have numeric values for R, phi1, phi2, theta1, theta2.
>I am tying to get numeric solutions for k1,k2,k3,k4.


You have 6 equations in 4 variables ?

Subject: Solving system of eqations

From: Marc

Date: 15 Jun, 2013 19:24:10

Message: 3 of 4

"Nasser M. Abbasi" wrote in message <kpidf7$nd5$1@speranza.aioe.org>...
> On 6/15/2013 12:44 PM, Marcus Glover wrote:
> > R=phi1/theta1+phi2/theta2=(k1/k2)*(1+k3/k4)
> >
> > delta=sqrt(((k2+k3+k4)^2)-4k2*k4)
> >
> > phi1=k1(theta1-k3-k4)/delta
> >
> > phi2=k1(theta2-k3-k4)/-delta
> >
> > theta1=(k2+k3+k4+delta)/2
> >
> > theta2=(k2+k3+k4-delta)/2
> >
> > I have numeric values for R, phi1, phi2, theta1, theta2.
> >I am tying to get numeric solutions for k1,k2,k3,k4.
>
>
> You have 6 equations in 4 variables ?

Do you have the optimization toolbox? If so, try fsolve().

Set up your function in its own m-file. Something like I did below.

doc fsolve. You will need to give it an initial guess for k. Double check what I tried below because I may have missed some parenthesis.

I agree with Nasser that your system as your currently state it is overdetermined. And you probably want to reduce it to 4 equations. I think f(1) in my "code" below is redundant and not needed. If you know phi1, phi2, theta1 and theta2 you know R, hence probably get rid of that.

If you can provide me with the work you tried and the values for phi's, theta's and R I can see what I get.....

function f = yourkfunk(k)

% Define your , R, phi1, phi2, theta1 and theta2 here...

delta=sqrt(((k(2)+k(3)+k(4))^2)-4k(2)*k(4));
f = zeros(5,1);

f(1) = R - ((k(1)/k(2))*(1+k(3)/k(4)));
f(2) = phi1 - (k(1)(theta1-k(3)-k(4))/delta);
f(3) = phi2 - (k(1)(theta2-k(3)-k(4))/-delta);
f(4) = theta1 - ((k(2)+k(3)+k(4)+delta)/2);
f(5) = theta2 - ((k(2)+k(3)+k(4)-delta)/2);

end

Subject: Solving system of eqations

From: Nasser M. Abbasi

Date: 15 Jun, 2013 23:49:16

Message: 4 of 4

On 6/15/2013 2:24 PM, Marc wrote:

> If you can provide me with the work you tried and the values
> for phi's, theta's and R I can see what I get.....
>
> function f = yourkfunk(k)
>
> % Define your , R, phi1, phi2, theta1 and theta2 here...
>
> delta=sqrt(((k(2)+k(3)+k(4))^2)-4k(2)*k(4));
> f = zeros(5,1);
>
> f(1) = R - ((k(1)/k(2))*(1+k(3)/k(4)));
> f(2) = phi1 - (k(1)(theta1-k(3)-k(4))/delta);
> f(3) = phi2 - (k(1)(theta2-k(3)-k(4))/-delta);
> f(4) = theta1 - ((k(2)+k(3)+k(4)+delta)/2);
> f(5) = theta2 - ((k(2)+k(3)+k(4)-delta)/2);
>
> end
>

fyi, Matlab says No solution.

-----------------
clear all
syms k1 k2 k3 k4 positive
syms R delta theta1 theta2 phi1 phi2

eq1 = R == (k1/k2)*(1+k3/k4)
eq2 = delta == sqrt(((k2+k3+k4)^2)-4*k2*k4)
eq3 = theta1 == (k2+k3+k4+delta)/2
eq4 = theta2 == (k2+k3+k4-delta)/2
eq5 = phi1 == k1*(theta1-k3-k4)/delta
eq6 = phi2 == -k1*(theta2-k3-k4)/delta
--------------------------
   
sol=solve(eq1,eq2,eq3,eq4,eq5,eq6,k1,k2,k3,k4)

Warning: 6 equations in 4 variables.
> In C:\Program Files (x86)\MATLAB\R2013a Student\toolbox\symbolic\symbolic\symengine.p>symengine at 56
    In mupadengine.mupadengine>mupadengine.evalin at 97
    In mupadengine.mupadengine>mupadengine.feval at 150
    In solve at 170
Warning: Explicit solution could not be found.
> In solve at 179

--Nasser

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us