0
votes

I've got the following code in matlab:

gamma=1.01;
[t,phi] = ode45(@(t,x)(gamma-F(x,pi/6, 0.5)), [0,100], 0);
plot(t,phi)
hold off; 
title('\gamma = 1.01')
function out = F(p, a, b)
phi = mod(p,2*pi);
out = (0      <= phi & phi < a     ).*(phi/a) ...
    + (a      <= phi & phi < pi/2  ).*((phi*(b-1)/((pi/2)-a))-(a*(b-1))/((pi/2)-a)+1)...
    + (pi/2   <= phi & phi < pi-a  ).*((phi*(1-b)/((pi/2)-a))-((pi-a)*(1-b))/((pi/2)-a)+1)...
    + (pi-a   <= phi & phi < pi+a  ).*(-phi/a + pi/a)...
    + (pi+a   <= phi & phi < 3*(pi/2)).*((phi*(1-b)/((pi/2)-a))-(((pi+a)*(1-b))/((pi/2)-a))-1)...
    + (3*pi/2 <= phi & phi < 2*pi-a).*((phi*(b-1)/((pi/2)-a))-(((2*pi-a)*(b-1))/((pi/2)-a))-1)...
    + (2*pi-a <= phi & phi < 2*pi  ).*(phi/a-2*pi/a);
end

And I have a question. Could you please say how to numerically integrate (I suppose it's called that way) this function in MATLAB?

So from this enter image description here Get this enter image description here