I want to add
2 views (last 30 days)
Show older comments
syms s
ode = matlabFunction(ilaplace(134/(s^2 + 16*s + 134)),'Vars',{'t','y'})
[t, y] = ode45(ode,[0 1],0);
subplot(1,2,2)
plot(t,y)
0 Comments
Accepted Answer
Ameer Hamza
on 4 Jun 2020
Edited: Ameer Hamza
on 4 Jun 2020
Based on your comment on other question for expression of ea(t): https://www.mathworks.com/matlabcentral/answers/541922-please-tell-me-how-to-use-ode45-code#comment_883106 the following shows how to use ode45 to solve this ODE with input saturation
[t, y] = ode45(@odeFun, [0 1], [0; 0]);
plot(t, y(:,1), 'o-')
function dxdt = odeFun(t, x)
% transfer function is equivalent to following ODE
% x'' = 4/9(-16x'+ea(t))
ea = (1-x(1))*303;
if ea > 100
ea = 100;
elseif ea < -100
ea = -100;
end
dxdt = zeros(2, 1);
dxdt(1) = x(2);
dxdt(2) = 4/9*(-16*x(2)+ea);
end
0 Comments
More Answers (0)
See Also
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!