How Can I Solve Three Equations with Three Unknowns in Matlab?

  • MATLAB
  • Thread starter gdogg123
  • Start date
  • Tags
    Matlab
In summary, the conversation is about a person who is having trouble solving three equations with three unknowns in Matlab. One of the equations is a differential equation and the person is looking for help on how to write it in Matlab and plot it against time. It is mentioned that the equations need to be linear for them to be solvable. The suggestion is to linearize the differential equation by taking the Fourier series and neglecting higher-order terms before using Matlab to solve it.
  • #1
gdogg123
3
0
Hello, I`m having trouble solving equations simultaneously in Matlab. I have three equations and three unknowns. Two equations are algebraic and one is a differential equation. Here are my three equations, any help would be appreciated:

1. (0.3*1.06*3348*Ttank)-(0.3*1.06*3348*Toutc)+(20*200*(sin(t/24*3.14))^8=0

2. (0.041*4418*20)-Toutw*4418*0.041+1000*((Ttank-20)-(Ttank-Toutw))/ln(Ttank-20)/(Ttank-Toutw)

3. 1.06*3348*1.5* dTtank/dt=0.03*1.06*3348*Toutc-0.03*1.06*3348*Ttank-1000*((Ttank-20)-(Ttank-Toutw))/ln(Ttank-20)/(Ttank-Toutw)

t is time and will simulate from 0 until 300. Intial condition for Ttank(0)= 40, so Ttank at 0 is equal to 40. Please I need help urgently. How can this be written in Matlab and how can we plot Toutw against t (time)? I would really appreciate any help.
 
Physics news on Phys.org
  • #2
For "n equations in n unknowns" to be solvable, the equations need to be linear. Your last one clearly isn't.

I suggest you should start by linearizing your differential equation. Take the Fourier series and neglect higher-order terms. Then we can look at how to use Matlab to solve this thing.
 

1. How do I solve 3 equations in Matlab?

To solve 3 equations in Matlab, you can use the "solve" function. This function takes in the 3 equations as inputs and returns the solutions as a vector. Make sure to define all variables in the equations before using the "solve" function.

2. Can I solve 3 equations with more than 3 variables in Matlab?

Yes, you can solve 3 equations with more than 3 variables in Matlab. However, you will need to provide additional equations or constraints to obtain a unique solution. Otherwise, Matlab will return a symbolic solution with variables in terms of each other.

3. How do I check if my solution for 3 equations in Matlab is correct?

You can check the correctness of your solution by substituting the values into the original equations and ensuring that the left side of the equation equals the right side. You can also use the "subs" function in Matlab to substitute the values and compare the results.

4. What if my 3 equations in Matlab do not have a solution?

If your 3 equations do not have a solution, Matlab will return an empty vector. This means that the equations are inconsistent and do not have a common solution. You may need to check your equations for errors or try using a different method to solve them.

5. Can I solve 3 equations with complex numbers in Matlab?

Yes, Matlab can handle complex numbers in equations and solve for complex solutions. However, you will need to use the "solve" function with the "ReturnConditions" option to obtain both real and imaginary solutions. Otherwise, Matlab will only return real solutions.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • Introductory Physics Homework Help
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
7K
Back
Top