Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi everyone,
I did this project on Matlab so I'm not sure how it should be at MathCAD. I have 1 condition
Td(t) = if(t<theta,To,T*(t-theta).
My professor got the result from MathCAD, I'm not sure how do we use if function here?
I also attached the file in this post, the issue was occur at scenario 3.
Thank you so much again,
Solved! Go to Solution.
You did not specify an initial condition for T.sf, so I used a random value (T.sf(0)=100°F).
Obviously you want it to change to T.sf(0)=120°F,
You only show scenario 1.
But the units for hc include capacitance instead of temperature:
Try
Hello
I fixed that already. I think I attached the wrong file.
Would you please help me to take a look again please?
Thank you so much
Your function T.d creates a unit mismatch and is incomplete.
For t=1 minute the result is a temperature but for t<1 minute the result is temperature times time and for t>1 minute there is no result defined:
BTW, what you wrote
Td(t) = if(t<theta,To,T*(t-theta)
could be done the very same way in Prime, too. Mathcad and also Prime offer two ways for an if. The if-statement in a program as you had used and the if-function (similar to the if function in a spreadsheet).
To duplicate in your program what the if-function does, you would have to use the "else" statement instead of the second "if". But the unit problem remains.
Hello,
Td = T(t)(t-theta). the T(t) was defined in the ODEs equation. so the purpose is finding T(t) using the first 3 ODEs, then plug T(t) to "if" function.
He said I could define Td like he did. But i'm not sure
T(t) returns a temperature, t and theta are time, so the result of T.d(t) would be temperature * time. Is this really what its supposed to be? I guess - no.
If the "original" was done with real Mathcad (version 15 or below), then it had to be done without units because odesolve-blocks did not work with units. Thats the reason you won't expirience the error in that version.
I am not sure if it makes sense, but you could get rid of the time by simply dividing by s
But you have a discontinuity at 1 min, which may be the reason for the odesolve-block after its definition to fail with some kind of strange error.
Hello,
I think I wrote it wrong. Td is the temperature of T(t) at time (t-1 min).
Example, Td = T at (time-1) which mean at t=0 min, T(t)=120, and at t=1, T(t) = 119. Td supposed to be the same as T at t=0 min and t=1 min
However, there is one minute delay so at t=1mins, Td = 120, which is the last value of T(t). and Td won't generate any reading at t=0
I hope this makes sense.
I wrote in matlab is for i=1:100, Td=T*(i-1), i is time range in minute.
Thank you so much!
You mean something like this:
I guess it would be better to replace "322.039 K" by "T(theta)".
According the solve block: You have an equation for a function T.sf there which you do not solve for. get rid of it and the solve block should work OK:
Hello,
that is what I did in scenario 2. now i need to solve for Tsf in scenario 3. Do you think if I specify in scenario T(t) will it be able to read the value from last run in scenario 2?
Whatever variable or function name you use, Prime will use the last definition of it.
But as you use T(t) as a function to solve for in your new solve block, Prime can't (and shouldn't) use last definition of it from the previous solve block.
I will remove the first 3 odes and will just define Td based on T(t) from last run. I hope it work
@TN_9676358 wrote:
I will remove the first 3 odes and will just define Td based on T(t) from last run. I hope it work
It does 😉
But the interval in the solve block for T must be a bit larger than the one for T.sf:
It has to do with the numerical derivatives the algorithm uses.
sorry i just read the message 😞 The graph I'm looking for looks differently. Im not sure what wrong. everything will need to start at T=120F. Do you have any ideas where am I wrong?
You did not specify an initial condition for T.sf, so I used a random value (T.sf(0)=100°F).
Obviously you want it to change to T.sf(0)=120°F,
Hello,
So Td and Tsf will start the first point at t=1, I specify the value of Tsf(0)=120F and they say the ODE range is larger. I believed for Td, because Td won't start until t=1, I think if t<0, there is no Td value.
Let me attached the new files for you.
I will need to specify both Tsf and Td starts at t=1 min.
Thank you so so much for your help
i got it. thank you so much.