please help me to solve bayesian compressive sensing code

20 visualizzazioni (ultimi 30 giorni)
clc; clear all; close all; %check if terminates? if count > 2 && abs(ML(count)-ML(count-1)) < (max(ML)-ML(count))*eta break; end % update alphas which = find(index==idx); if theta(idx) > 0 if ~isempty(which) % re-estimate Alpha = theta(idx); delta = Alpha-alpha(which); for k = 1:NT Sigii = Sig{k}(which,which); mui = mu{k}(which); Sigi = Sig{k}(:,which); ki = delta/(1+Sigii*delta); mu{k} = mu{k}-ki*mui*Sigi; Sig{k} = Sig{k}-ki*Sigi*Sigi'; comm = PHI{k}'*(phi{k}*Sigi); S(:,k) = S(:,k) + ki*(comm.^2); Q(:,k) = Q(:,k) + ki*mui*comm; G(:,k) = G(:,k) + ki*(Sigi'*PHIt(index,k))^2; end % alpha(which) = Alpha; else % adding Alpha = theta(idx); for k = 1:NT phii = PHI{k}(:,idx); Sigii = 1/(Alpha+S(idx,k)); mui = Sigii*Q(idx,k); comm1 = Sig{k}*(phi{k}'*phii); ei = phii-phi{k}*comm1; off = -Sigii*comm1; Sig{k} = [Sig{k}+Sigii*comm1*comm1', off; off', Sigii]; mu{k} = [mu{k}-mui*comm1; mui]; comm2 = PHI{k}'*ei; S(:,k) = S(:,k) - Sigii*(comm2.^2); Q(:,k) = Q(:,k) - mui*comm2; G(:,k) = G(:,k) - Sigii*(t{k}'*ei)^2; phi{k} = [phi{k},phii]; end % index = [index;idx]; alpha = [alpha;Alpha]; end else if ~isempty(which) % deleting for k = 1:NT Sigii = Sig{k}(which,which); mui = mu{k}(which); Sigi = Sig{k}(:,which); Sig{k} = Sig{k}-Sigi*Sigi'/Sigii; Sig{k}(:,which) = []; Sig{k}(which,:) = []; mu{k} = mu{k}-mui/Sigii*Sigi; mu{k}(which) = []; comm = PHI{k}'*(phi{k}*Sigi); S(:,k) = S(:,k) + (comm.^2)/Sigii; Q(:,k) = Q(:,k) + mui/Sigii*comm; G(:,k) = G(:,k) + (Sigi'*PHIt(index,k))^2/Sigii; phi{k}(:,which) = []; end % index(which) = []; alpha(which) = []; end end
%end % output weights = zeros(M,NT); for k = 1:NT weights(index,k) = mu{k}; end
  1 Commento
Walter Roberson
Walter Roberson il 5 Gen 2018
You did not post an error message and you did not describe the difference between the output you get and the output you expect

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by