Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Solving for Unknowns in Equations

jyejye Posts: 2Member
I am trying to solve two equations with two unknowns in MATLAB, given a matrix of values to solve for.

For example, My flowrate is Q = 0:5:80

The two equations are:

1) Q = Q1 + Q2 (Easy equation)

2) f6*(L6/D6)*(V6^2/(2*g))......

Equation 2 is long. What I need to do though, without writing out the equation in longform, is to keep Q1 and Q2 as variables, instead of defining them as something.

For example: f6 is a function of Re... which along with V6 is a function of Q2. I do not know what Q2 is since I am trying to solve for it.. Similarily the same thing with Q3.

How can I define Re, V6, f6, etc... so I can use them in the equation 2 above and solve for Q2 and Q3?

This sounds totally confusing and I apologize.

Thanks for your help!

Comments

  • nstonenstone Posts: 2Member
    I had to do a problem similar to this not too long ago. What I did was solve for one unknown variable by hand; your Q2, for example. Then use the 'fzero' command by plugging Q2 into your second equation and setting it equal to zero. That will give you the value of your unknown. If you are needing matlab to solve this completely without doing any of it by hand, I'm not sure how you would go about doing that.
  • nstonenstone Posts: 2Member
    I had to do a problem similar to this not too long ago. What I did was solve for one unknown variable by hand; your Q2, for example. Then use the 'fzero' command by plugging Q2 into your second equation and setting it equal to zero. That will give you the value of your unknown. If you are needing matlab to solve this completely without doing any of it by hand, I'm not sure how you would go about doing that.
  • jyejye Posts: 2Member
    Thanks for your response, I will give it a shot. The biggest thing about this was that I want to keep Q1 and Q2 variables in their respective equations. What I mean is that normally yo uwoudl define your variables first, ie" Q1 = 5; Q2 = 10; but since I am trying to solve for these given different values of Q, I want to keep them as blank variables without MATLAB getting mad at me for not defining them.

    I am confident there is a way to do this, I just can not seem to find out how.

    I will give the fzero function a shot though.

    Thanks!
Sign In or Register to comment.