Help indexing loops
- From: Travis <traviib@xxxxxxxxx>
- Date: Thu, 23 Mar 2006 02:40:11 -0500
Hey all,
I am trying to code a heat transfer problem, but cannot figure how to
to index for these loops... (If you don't know heat transfer, that is
OK! the help is with coding, not heat transfer)
I need to find the temperature at N different nodes.
So, for an example, I need to run this code for 6 nodes (m), and up
to a certain time (n), say 60 seconds
I will replace all the heat transfer junk with constants A, B, etc...
The equations would look like this... where T1 is temp at node one,
T2 at node 2, and so on... and n is the time
T1(n+1) = A*(T0(n)-T2(n))+(B*T1(n)^4)-C*(T1(n)^4-Tsurr^4)+D
T2(n+1) = A*(T1(n)-T3(n))+(B*T2(n)^4)-C*(T2(n)^4-Tsurr^4)+D
T3(n+1) = A*(T2(n)-T4(n))+(B*T3(n)^4)-C*(T3(n)^4-Tsurr^4)+D
etc, etc...
This is what I tried, but it failed because it created a character
string...
m = 0;
n = 0;
for m = 1:N
for n = 1:t
(['T' int2str(m)])(n+1) = A(['T' int2str(m-1)])(n) + (['T'
int2str(m+1)])(n) + B*(['T' int2str(m)])(n)^4 - C*(['T'
int2str(m)])(n)^4-Tsur^4)+D
end
end
Anyone see where I am going with this...?
Thanks for your time.
.
- Follow-Ups:
- Re: Help indexing loops
- From: French Caro
- Re: Help indexing loops
- Prev by Date: finding transformation
- Next by Date: Re: Seeting callback for PreSaveFcn of model
- Previous by thread: finding transformation
- Next by thread: Re: Help indexing loops
- Index(es):