The SS equation dx/dt=A_i(KF)*x+ B_i*u, where i =1,2, with y=C*x and D=0. u=-q*p*x+q*Uy (p and q = const) and
KF=0.5*(1+sign(Uerr)) for KF is the switching function. But for finding the feedback error, that is, Uerr(X,t) which is equal to u - Up(t), which is Uerr(X,t)=u-Up(t).
Hence, a = 1/Fs where Fs=50kHz and Up(t) = 5*[(t/a)-floor(t/a)].
How to run or simulate those above methods in MATLAB for q = 1:500 and save all values of x?