I have a problem implementing a recursive funcion in Mathcad Prime 3.1, hope someone can help me make it work. I want to calculate a heat transfer layer per layer. So the array should work like this: T_layer,time
Here's what I want it to do: Take given Temperature T_0,0 and given Temperature T_1,0 and calculate Q.dot_1,1. With Q.dot_1,1 and a given time increment (t) calculate Q_1,1. With Q_1,1 and the mass (which is dependent on the layer) I want to calculate T_1,1. With it and T_0,1 (given) calculate Q.dot_1,2 and so on Meanwhile it should also calculate the other layers. So T_1,0 and T_2,0 (both given) to Q.dot_2,1 with t to Q_2,1 with the mass to T_2,1. Now T_2,1 and T_1,1 (from the first layer calculation) to Q.dot_2,2 and with t to Q_2,2 and so on. I hope I could explain it well enough.
Thanks in advance, David
EDIT: Thanks to FredKohlhepp I zipped and uploaded the worksheet
Solved! Go to Solution.
Attaching a MC file; right-mouse-click your file and "send to" "compressed folder (zip)" should zip it , which then can be attached to your post..
Attached is an example of muti-layered walls. Unfortunately, in P4, so I attach a pdf.
I hope this helps.
There's an old technique, initializing the first element of vectors, then stepping thru calculating each successive step in each vector. I've attached a not-very-good example.
In this wonderful new web application many of us have to zip a file to attach it. This problem was highlighted when the application first went into service, and PTC promised to have it fixed. Like so many of their promises . . .
Thanks for the answer. This way of calculating could proof itself helpful.
Though when I try this I get an error I don't really understand saying the array index istn't valid. And that the index can't be smaller than ORIGIN neither bigger than the last element. But I don't see why it should be any of those. I attached the file trying this way of calculation.
You'rre running 3.1, I'm running 3.0--I can't open your file, you can't save back.
Attach a PDF and thank PTC for their marketing stragety!
You have not initialized theta. Note that by default array indices in Mathcad start at 0, not 1 (that is what ORIGIN is).
If you initialize theta you have a unit mismatch problem.
Edit: You did initialize it, but you are attempting to get theta(1,0), which does not exist. And you still have a unit mismatch in the second expression.
Here's the picture, Fred.
I guess the intent is to implement the recursion with just an assignment of a 2 element vector to a 2 element vector.
I'm afraid it doesn't work like that. Could be nice if it did though...
Corrected the units (added W to the definition of Q[1,1
And I preset the final indices of the two result arrays Q and theta, so that the matrices can be filled.
This is what I get:
It's now free of mathcad errors, not necessarily free of mathematical or physical (modelling) errors.
I Leave that up to the OP.
Looking at the first step of the calculation where z=1 and s=1, your definition of Q[1,1 and Theta[1,1 both require Theta[1,0. However, Theta[1,0 is undefined.
Can you provide the result that you expect in your example?
Yes, thats true, thanks for the clue.
Now I took the error free version of LucMeekes (Thanks alot!) and fixed some technical conditions.
I already calculated the complete loop manually which gives you the expected result. I attached the manual calculation and the new array calculation as pdf and Mathcad Prime 3.1 worksheet.
As you can see there the first Q._1,1 is calculated correct, but it doesn't calculate a new Temperature and I don't know why not.
Also I'm confused why I need to define Q._s_E/s_R,9 but if I don't some error is happening.