%% Fuzzy_Paper Implementation : 
%  IEEE TRANSACTIONS ON FUZZY SYSTEMS, VOL. 20, NO. 4, AUGUST 2012
%  ---------------------------------------------------------------
% Compute Error : 
function A = computeA(X, C, Sig)    
c = size(C, 1);
[n, p] = size(X);
Mu = zeros(n, c);%(size(X, 2) + 1)*size(C, 1)); 
for c = 1:size(C, 1)
    Cx = repmat(C(c, :), size(X, 1), 1); 
    Sigx = repmat(Sig(c, :), size(X, 1), 1); 
    FirStr = exp(-(X-Cx).^2./Sigx.^2); 
    Mu(:, c) = prod(FirStr, 2);
end
A = zeros(n, (p + 1)*c);
A(:, 1:c) = Mu;
for i = 2:p+1
    A(:, (i-1)*c+1:i*c) = Mu.*repmat(X(:, i-1), 1, c); 
end

