function f = resonant_jump(A,kolor) %amplitude of the step function A > 0 T = 20; dt = 0.05; t = 0:dt:T; x0 = [0; 0]; OPT = odeset('RelTol',1e-6,'AbsTol',[1e-6]); [t,x] = ode45(@nonlin_oscillator,t,x0,OPT,A); uh = plot([-0.1 t(1) t(end)], [0 A A],'--','Color',num2str(kolor),'LineWidth',2); hold on yh = plot(t,x(:,1),'Color',num2str(kolor),'LineWidth',2); legend([uh, yh],'Input','Output','Location','best') set(gca,'FontSize',16,'FontWeight','b','FontAngle','i', ... 'Xlim',[t(1) t(end)]) xlabel('Time'); f = x(:,1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [dx] = nonlin_oscillator(t,x,u) dx = zeros(2,1); dx(1) = x(2); dx(2) = -x(1) - 2*(1-u)*x(2) + u;