📄 cs_exam.m
字号:
clear
n=512; %size of the signal
m=64; %Number of samples(under sample by a factor)
k=0:n-1;
t=0:n-1;
F=exp(-i*2*pi*k'*t/n)/sqrt(n); %Fourier matrix
freq=randsample(n,m);
A=[real(F(freq,:));imag(F(freq,:))]; %Incomplete fourier matrix
s=28;
support=randsample(n,s);
x0=zeros(n,1);
x0(support)=randn(s,1);
b=A*x0;
cvx_begin
variable x(n);
minimize(norm(x,1));
subject to
A*x==b;
cvx_end
norm(x-x0)/norm(x0);
figure;
plot(1:n,x0,'b*',1:n,x,'ro'), legend('original','decoded');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -