From: IAN SAl on
Hello everyone

I have an ODE solver computing the temperature every month during a year

this script will do the job

for j=1:12
[t,T]= ode45(@monthly_solver,tspan,Tic,[],monthly_heat(j),h2(j),);
end

where Tic is the intial temperature and J loops represents the months

Now the question is about matlab principle and how does it work with the initial condition? i mean

as the last temperature of the 1st month is the begining temperture of the 2nd month and the last temp. of the 2nd month is the begining temp. of the 3rd month and so on. Do i need to write a command to do this job or just give the matlab the intial condition for time zero and the matlab itself will do this ?

Please help ASAP and any helps will be greatly appreciated

Thanks

IAN
From: IAN SAl on
hmmmm?!!
From: Steven Lord on

"IAN SAl" <ib52(a)hotmail.com> wrote in message
news:hpo0u8$10v$1(a)fred.mathworks.com...
> Hello everyone
> I have an ODE solver computing the temperature every month during a year
>
> this script will do the job
>
> for j=1:12 [t,T]=
> ode45(@monthly_solver,tspan,Tic,[],monthly_heat(j),h2(j),);
> end
>
> where Tic is the intial temperature and J loops represents the months
>
> Now the question is about matlab principle and how does it work with the
> initial condition? i mean
>
> as the last temperature of the 1st month is the begining temperture of the
> 2nd month and the last temp. of the 2nd month is the begining temp. of the
> 3rd month and so on. Do i need to write a command to do this job or just
> give the matlab the intial condition for time zero and the matlab itself
> will do this ?

The way you've written this code, you need to properly define the initial
condition to enforce that condition. Look at the BALLODE demo for an
example that does something like this; it sets the initial position and
velocity of a bouncing ball based on its position and velocity when it hit
the ground.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: IAN SAl on
Thanks Steve