%%%% Steps of numeric double integration
%%%% Analytic method
clear;clc;clf reset;warning off MATLAB:divideByZero;close all
sitil = ['-k  ';'--k ';':k  ';'-.k ';'-xb ';'-om ';'--om';':om ';'-.om';'-*g ';'-.xk']
syms xt t T
xt = 1/(1 + (2*t/T)^2);tp = -4:0.01:4;
xt1 = 1./(1 + (2*tp).^2);xt2 = 1./(1 + (tp).^2);xt3 = 1./(1 + abs(tp)); 
plot(tp, xt1,sitil(1,:));hold on;plot(tp, xt2,sitil(2,:));hold on;plot(tp, xt3,sitil(3,:));hold off
Xmat = [];
for m = -1:1
    Xr = [];
    for n = -1:1
        t = m*T - n*T/2;t = m*T - n*T;
        el = eval(xt);
        Xr = [Xr el];
    end
    Xmat = [Xmat;Xr];
end
q = [0;1;0];
c = inv(Xmat)*q
%Xmat