×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Trying to solve 4 equations in matlab!

Trying to solve 4 equations in matlab!

Trying to solve 4 equations in matlab!

(OP)
Hi I am trying to solve the following equations using Matlab for C1, C2, C3 and C4. In real fact I only require C1.

C1-C2-C3-1=0
n*C2+C3/n+(d-1)*C4=0
C1+b*C2-b*C3-1=0
b*n*C2-b*C3/n-C4(1+d)=0

This is what I have input in Matlab but it seems its getting stuck because of the symbolic expresssion??

Any help please?

syms C1 C2 C3 C4 g L g_0 dL
n=exp(-g*L)
d=exp(-2*g_0*dL)
solve(C1-C2-C3-1, n*C2+C3/n+(d-1)*C4, C1+b*C2-b*C3-1, b*n*C2-b*C3/n-C4(1+d), C1)

RE: Trying to solve 4 equations in matlab!

g, L, dL are also unknown by that expression


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

RE: Trying to solve 4 equations in matlab!

and g_0


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

RE: Trying to solve 4 equations in matlab!

(OP)
I would like to solve for c1 in terms of g_0, DL etc..

RE: Trying to solve 4 equations in matlab!

You still have more unknowns than equations..


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

RE: Trying to solve 4 equations in matlab!

Having more unknowns can yield many solutions. Here is what maple gave me:

CODE -->

> B := solve({n*C2+C3/n+(d-1)*C4 = 0, b*n*C2-C3/n-(1+d)*C4 = 0, C1-C2-C3-1 = 0, C1+b*C2-b*C3-1 = 0});
print(`output redirected...`); # input placeholder
     /                                                
     |     2 b C3 + 1 + b       C3 (-1 + b)           
    < C1 = --------------, C2 = -----------, C3 = C3, 
     |         1 + b               1 + b              
     \                                                

           1          1              
      C4 = - n C3 b - - n C3, b = b, 
           2          2              

                  2  2        2        2       \   
          -2 b + b  n  - 2 b n  - 2 + n        |   
      d = ------------------------------, n = n >, 
                2                              |   
               n  (-1 + b) (1 + b)             /   

      {C1 = 1, C2 = 0, C3 = 0, C4 = 0, b = b, d = d, n = n}
> 


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

RE: Trying to solve 4 equations in matlab!

(OP)
I have 4 equations and I need to find c1, c2, c3 and c4, so 4 equations, 4 unknowns

RE: Trying to solve 4 equations in matlab!

So put numbers (real values) in for those other symbolic representations and you are done in about 10 seconds.


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

RE: Trying to solve 4 equations in matlab!

(OP)
Can't do that as I require a general expression. Is that possible in Matlab? Any idea why my code is not working?

RE: Trying to solve 4 equations in matlab!

I was trying to see if you understood your fundamental mistake. You are NOT differentiating between constants and variables in your work. That is why I say you have more variables. Matlab thinks there are more than there are.

All you need to do it tell it which ones are vars. ...

CODE -->

Q= solve('C1-C2-C3-1','n*C2+C3/n+(d-1)*C4','C1+b*C2-b*C3-1','b*n*C2-b*C3/n-C4(1+d)','C1','C2','C3','C4');

Q.C1 


"Simplicity is the ultimate sophistication." L. da Vinci
- Gian

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources