I am trying to implement a numerical integration using ode45.
I have the following function that I want to integrate:
Where and are vectors of size (1x199) that change depending on the time. Also, is a vector of size (1x199) that is constant and each of its elements contain the value 9.81 .
So, I created the ode45 problem as follows:
1 - In the main script, I have the following:
gt = linspace(0,1.99,199);
g = -tan(phi).*(zdd + gravity);
tspan = [0 1.99];
ic = 0;
opts = odeset('RelTol',1e-2,'AbsTol',1e-4);
[T_yd,yd] = ode45(@(T_yd,yd) myode_ydd(T_yd,gt,g), tspan, ic, opts);
2 - Then, the function myode_ydd has the following form:
function dydt = myode(t,gt,g)
g = interp1(gt,g,t);
dydt = g;
When I run the code, the length of the outputs T_yd and yd is 41.
Is there a way to keep the outputs of length 199?
Thank you for taking the time to read my question