- #1
tectactoe
- 39
- 0
Basically, I need to solve a transient heat transfer conduction problem. I've got most of the work done but I need to solve the problem using MATLAB or C++ or some other kind of coding. That's what I need help with.
The actual aspects of the problem aren't really that important, so I will try to explain the part I need help with, without getting into too much detail.
I have a 12x12 matrix, we will call it [A]. This matrix contains coefficients for a series of equations that contain variables [tex]T_{n}^{i+1}[/tex], from n = 1 to 12. Then we have the answer matrix, we'll call matrix [C] which is a 12x1 matrix with values [tex]T_{n}^{i}[/tex], also from n = 1 to 12. Initially, at t=0, [tex]T_{n}^{i} = 0[/tex] for all n.
We then solve for matrix which contains the variables of which [A] holds the coefficients of, as mentioned before, [tex]T_{n}^{i+1}[/tex].
This can be easily done by [tex] = [A]^{-1}[C][/tex]
Then matrix will hold all my answers for [tex]T_{n}^{i+1}[/tex] from n = 1 to 12.
Now my problem is, for the next time step, say t = 1s, I need to use the answers held in matrix and essentially plug those values in for the previous values held in matrix [C], and repeat the calculation for a new matrix after 1s. Then, I take those new values and sub those into the [C] matrix again and get yet another new matrix for 2s. I need to do this for very many time steps, so I know a loop must be used.
The problem is, I am awful with coding and don't know how this can be done.
Any help would be appreciated. If you are having trouble understanding my question, please ask and I will clarify.
Thank you!
The actual aspects of the problem aren't really that important, so I will try to explain the part I need help with, without getting into too much detail.
I have a 12x12 matrix, we will call it [A]. This matrix contains coefficients for a series of equations that contain variables [tex]T_{n}^{i+1}[/tex], from n = 1 to 12. Then we have the answer matrix, we'll call matrix [C] which is a 12x1 matrix with values [tex]T_{n}^{i}[/tex], also from n = 1 to 12. Initially, at t=0, [tex]T_{n}^{i} = 0[/tex] for all n.
We then solve for matrix which contains the variables of which [A] holds the coefficients of, as mentioned before, [tex]T_{n}^{i+1}[/tex].
This can be easily done by [tex] = [A]^{-1}[C][/tex]
Then matrix will hold all my answers for [tex]T_{n}^{i+1}[/tex] from n = 1 to 12.
Now my problem is, for the next time step, say t = 1s, I need to use the answers held in matrix and essentially plug those values in for the previous values held in matrix [C], and repeat the calculation for a new matrix after 1s. Then, I take those new values and sub those into the [C] matrix again and get yet another new matrix for 2s. I need to do this for very many time steps, so I know a loop must be used.
The problem is, I am awful with coding and don't know how this can be done.
Any help would be appreciated. If you are having trouble understanding my question, please ask and I will clarify.
Thank you!