www.gusucode.com > 压缩感知重构算法 压缩感知源码程序 > CS_mse.m

    clc;
clear all;
sig0=load('shuju3.txt');
% sig0=sig01';

xfs=40;
points=4096;
f = xfs/2*(1:points)/points;
figure;
plot(f,sig0);
grid on;

M = 2^12;
%sig0 = MakeBlocks(M)';
qmf = MakeONFilter('Haar',1);

SNR = 30;
%randn('seed', 2.055615866000000e+09);
%[sig0 y]= NoiseMaker(sig0, SNR);
% y=awgn(sig0,SNR);
y=sig0;

L = 3;
alpha0 = FWT_PO(y, L, qmf);
for N=96:100:4096

% Generate Random Dictionary
Phi = MatrixEnsemble(N,M);
% generate the vector S
S = Phi * alpha0;
% Solve the BP problem
alpha = SolveStOMP(Phi, S, M);
sig1 = IWT_PO(alpha,L,qmf);

mse(N)=twonorm(sig1-sig0)./twonorm(sig0);
end
figure;
N=96:200:4096;
semilogy(N/M,mse(N));
axis([0 1 0 1]);
title('MSE=E[||S_{x0}-S_{x}||_{2}/||S_{x}||_{2}]');
xlabel('压缩率N/M');
ylabel('MSE');
grid on;