压缩感知(十)
压缩感知仿真验证 一维信号重建实验 clear; close all; choice_transform=1; choice_Phi=0; n = 512; t = [0: n-1]; f = cos(2*pi/256*t) + sin(2*pi/128*t); % n = length(f); a = 0.2; m = double(int32(a*n)); switch choice_transform case 1 ft = dct(f); disp('ft = dct(f)') case 0 ft = fft(f); disp('ft = fft(f)') end disp(['ÐźÅÏ¡Êè¶È£º',num2str(length(find((abs(ft))>0.1)))]) figure('name', 'A Tone Time and Frequency Plot'); subplot(2, 1, 1); plot(f); xlabel('Time (s)'); % ylabel('f(t)'); subplot(2, 1, 2); switch choice_transform case 1 plot(ft) disp('plot(ft)') case 0 plot(abs(ft)); disp('plot(abs(ft))') end xlabel(