How to set an initial value for an equation?

Im running on matlab 2014b so i cannot use the setinitialcondition function. This is what I have so far:
T1 = 750 + [(300-750)*1.0148*0.9776*exp(-1.64*10^-3*t)]
T2 = 750 + [(300-750)*1.0712*0.8812*exp(-7.7*10^-3*t)]
T3 = 750 + [(300-750)*1.1345*0.7652*exp(-0.0144*t)]
And im going to plot each with time, however for t = 0, i need the functions T1, T2, T3 to start from 300, then increase according to the equation above. So how can i do that?

Answers (2)

They won't, with your existing equations. You'd have to alter some of the numbers.
t = 0
T1 = 750 + [(300-750)*1.0148*0.9776*exp(-1.64*10^-3*t)]
T2 = 750 + [(300-750)*1.0712*0.8812*exp(-7.7*10^-3*t)]
T3 = 750 + [(300-750)*1.1345*0.7652*exp(-0.0144*t)]
t =
0
T1 =
303.569184
T2 =
325.226352
T3 =
359.34627
There are several numbers that could be changed to achieve those temperatures at time t=0. Which do you want to change?
You can want them to start at 300, when t == 0, but they don't. Period.
I'll write them as a function handle. And I will not create numbered variables, which is just poor code style.
T = @(t) [750 + [(300-750)*1.0148*0.9776*exp(-1.64*10^-3*t)];
750 + [(300-750)*1.0712*0.8812*exp(-7.7*10^-3*t)];
750 + [(300-750)*1.1345*0.7652*exp(-0.0144*t)]]
T =
function_handle with value:
@(t)[750+[(300-750)*1.0148*0.9776*exp(-1.64*10^-3*t)];750+[(300-750)*1.0712*0.8812*exp(-7.7*10^-3*t)];750+[(300-750)*1.1345*0.7652*exp(-0.0144*t)]]
T(0)
ans =
303.569184
325.226352
359.34627
So when T == 0, you don't get 300 out. PERIOD. You cannot make mathematics do something that is not consistent. Well, unless your name is Harry Potter. How are your wanding skills?
Essentially, in order to force them to be 300 when t==0, you need the product
1.0148*0.9776
ans =
0.99206848
to be exactly 1. It is not. Nor are the comparable products in the other terms exactly 1.
1.0712*0.8812
ans =
0.94394144
1.1345*0.7652
ans =
0.8681194
Not even close. So 300 will never happen, as you have it written now.

Asked:

on 7 Oct 2017

Edited:

on 7 Oct 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!