The second input to coder.internal.reallocDynamicMatrix must be indexInt.
Show older comments
I want to use ode45 in matlab function(that is block of sumulink).
However, i cannot do it when i tried to use ode45 for solve second‐order differential equation.
Would you tell me how to use ode45 in matlab function?
i tried the following code.
function yout = fcn(u)
[t,y] = ode45(@vdp1,[0 20],[2; 0]);
yout = y(end,:);
end
function dydt = vdp1(t,y)
dydt = [y(2); (1-y(1)^2)*y(2)-y(1)];
end
Answers (0)
Categories
Find more on Ordinary Differential Equations 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!