function [A,B,Q] = HMM_LEV(O)

param = size(O,1);
Q = 7;

mu=zeros(param,Q);
vr=zeros(param,Q);
cv=zeros(param,param,Q);

mu(:,2) = [ -7.313049e+000 -9.398881e-001 -4.510057e-001 -7.288507e-001 -2.897759e-001 -7.751375e-002 -3.618123e-003 -1.390386e-001 2.084902e-001 -1.320959e-001 8.817019e-002 -1.228079e-001 6.917090e+001 -3.107722e-002 8.907292e-003 9.247836e-003 1.905289e-002 1.233459e-002 1.001064e-002 1.002233e-002 8.150973e-003 3.113299e-003 3.548607e-003 2.532211e-003 1.085190e-003 -1.025690e-001 7.951854e-003 -8.182072e-003 -6.170174e-003 -1.514464e-002 -6.019351e-003 -8.480256e-003 -3.986343e-003 -5.266401e-003 -1.843392e-003 -2.877901e-003 -8.476687e-004 -6.497114e-004 8.289810e-002]';
vr(:,2) = [3.163979e+000 2.168602e+000 1.371846e+000 1.517981e+000 9.038908e-001 8.897811e-001 6.909518e-001 5.652684e-001 5.599021e-001 5.125359e-001 4.591469e-001 4.670824e-001 3.629802e+001 1.388832e-001 9.953099e-002 7.722628e-002 7.820329e-002 6.347974e-002 6.216895e-002 5.599645e-002 5.214563e-002 4.893730e-002 4.565161e-002 4.265450e-002 4.052969e-002 8.744203e-001 2.787767e-002 2.031806e-002 1.623932e-002 1.644616e-002 1.327494e-002 1.286692e-002 1.156766e-002 1.087449e-002 1.014029e-002 9.546626e-003 8.929418e-003 8.537616e-003 1.812941e-001]';
cv(:,:,2) = diag(vr(:,2));
gconst(2) = -1.317014e+001;

mu(:,3) = [-3.138562e+000 -7.563502e+000 -5.290282e+000 -4.376231e+000 -2.091170e+000 -3.047654e+000 1.485340e-001 -8.863717e-001 -8.229234e-001 -1.056014e+000 -3.115347e-001 -3.907134e-001 1.126714e+002 7.114074e-002 2.502333e-002 -1.903201e-003 -1.097897e-002 -3.367439e-002 1.508203e-002 -6.131828e-004 -3.937151e-002 -1.496601e-002 8.862166e-003 -1.250381e-002 2.699794e-003 5.581088e-002 -4.953837e-002 1.082374e-001 7.827281e-002 6.524385e-003 5.559986e-003 3.333310e-002 -3.278174e-002 -1.276414e-002 2.668585e-002 1.384303e-002 -2.438150e-004 1.439625e-003 -4.991049e-001];
vr(:,3) = [7.957896e+000 5.985745e+000 5.029407e+000 3.139295e+000 3.380268e+000 2.804773e+000 2.255632e+000 2.815910e+000 1.662203e+000 1.213570e+000 1.003155e+000 1.022846e+000 1.342358e+002 3.952126e-001 4.495636e-001 2.976177e-001 2.014607e-001 1.734050e-001 1.758243e-001 1.295988e-001 1.152960e-001 1.039754e-001 8.132098e-002 6.836876e-002 5.616666e-002 6.967901e+000 7.364866e-002 5.511713e-002 3.916116e-002 3.259997e-002 2.821364e-002 3.241866e-002 2.274641e-002 1.881221e-002 1.772779e-002 1.452828e-002 1.248858e-002 1.058102e-002 7.020664e-001];
cv(:,:,3) = diag(vr(:,3));

mu(:,4) = [-5.652693e+000 -4.615658e+000 -2.951687e+000 -6.895529e+000 -2.690160e+000 -1.732640e+000 -4.101386e-001 -1.908145e+000 4.470546e-002 -1.065471e+000 -5.548403e-001 -4.460121e-001 1.102027e+002 2.847615e-001 1.058228e-001 5.352417e-002 3.017063e-002 -6.559902e-002 -2.231777e-002 -4.896455e-002 -2.233832e-002 -5.249316e-002 -6.145196e-004 -3.299612e-002 -1.492214e-002 -5.427094e-001 -6.388226e-002 1.414389e-001 5.564144e-002 1.609482e-001 6.562461e-002 -5.549205e-003 -2.051019e-003 5.329981e-002 -9.825671e-003 2.160343e-002 2.673190e-002 3.019699e-003 -1.050667e+000]';
vr(:,4) = [1.016467e+001 8.372550e+000 3.267163e+000 3.284851e+000 3.946333e+000 2.220042e+000 1.971026e+000 1.683012e+000 1.512034e+000 1.961291e+000 1.249286e+000 1.248523e+000 1.649046e+002 9.557528e-001 7.732920e-001 2.755146e-001 4.788254e-001 2.462779e-001 1.959681e-001 1.378614e-001 1.330008e-001 1.054550e-001 1.039458e-001 9.952246e-002 8.163809e-002 2.124301e+001 1.870248e-001 1.010609e-001 4.240693e-002 5.646939e-002 4.331052e-002 3.720109e-002 2.576043e-002 2.202496e-002 1.933648e-002 1.898772e-002 1.799011e-002 1.529474e-002 1.844348e+000]';
cv(:,:,4) = diag(vr(:,4));

mu(:,5) = [-9.876414e+000 -3.330886e+000 -4.641456e-001 -2.904141e+000 -7.620842e-001 -8.903880e-001 6.366627e-002 -7.904418e-001 2.873822e-001 -4.455305e-001 1.342169e-001 -2.536658e-001 8.587737e+001 -3.846735e-001 -8.973704e-002 -3.007430e-002 -7.773304e-002 6.340612e-002 5.317002e-002 6.696295e-002 6.901325e-002 6.946636e-002 1.995412e-002 3.965143e-002 2.181135e-002 3.849454e-001 2.293267e-001 -2.164124e-002 -1.452997e-001 -1.103563e-001 -5.288787e-002 -6.848449e-002 -4.490872e-002 -1.282443e-002 -2.683019e-002 -1.738494e-002 -2.358475e-002 -8.467647e-003 7.052230e-001];
vr(:,5) = [1.185145e+001 6.044249e+000 2.779505e+000 3.458176e+000 1.769862e+000 1.542672e+000 1.188656e+000 1.148042e+000 8.838697e-001 7.740923e-001 6.137962e-001 5.362238e-001 1.149576e+002 2.306041e+000 4.755754e-001 4.073739e-001 3.805100e-001 1.992635e-001 1.833455e-001 1.471915e-001 1.146923e-001 9.532011e-002 7.760279e-002 7.400497e-002 5.841378e-002 9.893098e+000 2.240043e-001 9.366364e-002 5.632205e-002 4.851921e-002 3.005913e-002 2.696105e-002 2.473945e-002 2.092999e-002 1.766146e-002 1.509720e-002 1.327419e-002 1.189405e-002 1.184825e+000];
cv(:,:,5) = diag(vr(:,5));

mu(:,6) = [ -7.313049e+000 -9.398881e-001 -4.510057e-001 -7.288507e-001 -2.897759e-001 -7.751375e-002 -3.618123e-003 -1.390386e-001 2.084902e-001 -1.320959e-001 8.817019e-002 -1.228079e-001 6.917090e+001 -3.107722e-002 8.907292e-003 9.247836e-003 1.905289e-002 1.233459e-002 1.001064e-002 1.002233e-002 8.150973e-003 3.113299e-003 3.548607e-003 2.532211e-003 1.085190e-003 -1.025690e-001 7.951854e-003 -8.182072e-003 -6.170174e-003 -1.514464e-002 -6.019351e-003 -8.480256e-003 -3.986343e-003 -5.266401e-003 -1.843392e-003 -2.877901e-003 -8.476687e-004 -6.497114e-004 8.289810e-002]';
vr(:,6) = [3.163979e+000 2.168602e+000 1.371846e+000 1.517981e+000 9.038908e-001 8.897811e-001 6.909518e-001 5.652684e-001 5.599021e-001 5.125359e-001 4.591469e-001 4.670824e-001 3.629802e+001 1.388832e-001 9.953099e-002 7.722628e-002 7.820329e-002 6.347974e-002 6.216895e-002 5.599645e-002 5.214563e-002 4.893730e-002 4.565161e-002 4.265450e-002 4.052969e-002 8.744203e-001 2.787767e-002 2.031806e-002 1.623932e-002 1.644616e-002 1.327494e-002 1.286692e-002 1.156766e-002 1.087449e-002 1.014029e-002 9.546626e-003 8.929418e-003 8.537616e-003 1.812941e-001]';
cv(:,:,6) = diag(vr(:,6));
gconst(6) = -1.317014e+001;

A = [
    0.000000e+000 1.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000;
    0.000000e+000 9.649747e-001 3.502526e-002 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000;
    0.000000e+000 0.000000e+000 8.639915e-001 1.360085e-001 0.000000e+000 0.000000e+000 0.000000e+000;
    0.000000e+000 0.000000e+000 0.000000e+000 8.426186e-001 1.573814e-001 0.000000e+000 0.000000e+000;
    0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 8.456290e-001 1.543709e-001 0.000000e+000;
    0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 9.649747e-001 3.502526e-002;
    0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000 0.000000e+000;
    ];

B=zeros(Q,size(O,2));

for i = 1 : size(O,2)
    o = O(:,i);
    for j = 2 : Q-1
        B(j,i) =  (1/((((2*pi)^param)*det(cv(:,:,j)))^(1/2)))*exp(-0.5*(o-mu(:,j))'*inv(cv(:,:,j))*(o-mu(:,j)));
    end
end
