⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perf_test_online.m

📁 code for homotopy in compressed sensing
💻 M
字号:
clear;

rand('seed', 1);
randn('seed', 1);

k = 50;
m = 500;
testTime = 200;

for kIdx = 1:3
    for testIdx = 1 : testTime     
        % generate the matrix and signal
        signal = zeros(m,1);
        signal(1:k) = 1;
        A = randn(m,m);
        Y = A * signal;        
        
        % initialization
        c = A(1:40,:)'*Y(1:40);
        [lambda,J] = max(abs(c));
        cJ = exclude(m,J);           
        x  = zeros(m,1);        
                           
        % solve it increamentally                      
        for sampNum = 60:20:m
            currErr = norm(Y(1:sampNum)-A(1:sampNum,:)*x);
            if currErr / norm(Y(1:sampNum)) < 1e-2
               break;
            end
               
            % solve using the current observations
            oldA = A(1:sampNum-20,:);
            oldy = Y(1:sampNum-20);
            newA = A(sampNum-19:sampNum,:);
            newy = Y(sampNum-19:sampNum);
            [x, J, cJ, lambda] = onlineHomotopy(oldA, oldy, x, newA, newy, lambda, J, cJ);
               
        end
           
        % record results
        filename = sprintf('ol_GSresult_%d_%d_%.3f_%d.txt', GS_iter_Time,CS_iter_Time,SNR, countNoise);        
        fp = fopen(filename,'a');
        fprintf(fp,'%d %d %d ', GS_iter_Time,CS_iter_Time, k);
        fprintf(fp,'%f ', miniResidual / testTime);
        for t = 1 : length(slotNum)
            fprintf(fp,'%d ', slotNum(t));
        end
        fprintf(fp,'\n');
        fclose(fp);        
    end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -