function [Xs] = sigma_constrain (Xs)
[row col]=size(Xs);

x1max=Inf;%5500;
x1min=0;%3000;

x2max=Inf;;
x2min=0;

x3max=Inf;;
x3min=0;

for j=1:1:row
    for i=1:1:col
        if i==1 %state x1
            if Xs(i,j) < x1min
                Xs(i,j) =x1min;
            elseif Xs(i,j) > x1max
                Xs(i,j) =x1max;
            end
        elseif i==2 %state x2
            if Xs(i,j) < x2min
                Xs(i,j) =x2min;
            elseif Xs(i,j) > x2max
                Xs(i,j) =x2max;
            end
        elseif i==3 %state x3
            if Xs(i,j) < x3min
                Xs(i,j) =x3min;
            elseif Xs(i,j) > x3max
                Xs(i,j) =x3max;
            end
        end
    end
                
end