Clear Filters
Clear Filters

problem in the discretization of vectors

2 views (last 30 days)
Guido De Angelis
Guido De Angelis on 31 Jul 2015
Answered: Star Strider on 31 Jul 2015
hi! I would like find a solution for this problem. I integrate a function (fun1) in this way
[t,x] = ode45(fun1, [0 0.2], [0;0]);
Afterwards I integrate the same function but with different parameter's values (fun2).
[T,y] = ode45(fun2, [0 0.2], [0;0]);
Now I have to discretize the vectors x and y. I have to make constant steps that correspond to the same variation of time for both x and y. thanks a lot for your help!!

Answers (1)

Star Strider
Star Strider on 31 Jul 2015
Use a vector of time steps rather than only start and end times for ‘tspan’. This will give you 50 identical time steps for both integrations:
ts = linspace(0, 0.2, 50);
[t,x] = ode45(fun1, ts, [0;0]);
[t,x] = ode45(fun2, ts, [0;0]);

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!