f

#### How does matlab work in this issue ? a matlab principle question

```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 ?

Thanks

IAN
```
 0
IAN
4/9/2010 7:59:04 PM
comp.soft-sys.matlab 211264 articles. 25 followers. lunamoonmoon (257) is leader.

3 Replies
1479 Views

Similar Articles

[PageSpeed] 49

```hmmmm?!!
```
 0
IAN
4/11/2010 8:23:05 PM
```"IAN SAl" <ib52@hotmail.com> wrote in message
news:hpo0u8\$10v\$1@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@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

```
 0
Steven
4/13/2010 3:45:13 AM
```Thanks Steve
```
 0
IAN
4/19/2010 4:47:05 PM