?? exa090501.m
字號:
%----------------------------------------------------------------------------
% exa090501.m, for example 9.5.1,
%----------------------------------------------------------------------------
clear;
% 調用MATLAB中含有噪聲的數據文件 leleccum;
load leleccum;
index=1:3000;
x=leleccum(index);
N=8;
slength = length(x);
M=slength-100;
subplot(221);plot(x(1:M));
title('原始信號');
% 形成數據矩陣;
Signal=zeros(N,M);
for i=1:N
Signal(i,:)=x(i:M+i-1);
end
% 對數據矩陣作特征值分解;
[U, S, V]=svd(Signal);
d=diag(S(1:N,1:N));
subplot(222);stem(d,'filling');
title('特征值');
for i=1:N
if d(i)<mean(d)
d(i)=0;
end
end
stemp=S;
stemp(1:8,1:8)=diag(d);
Sf=U*stemp*V';
subplot(223);plot(Sf(1,:));
title('濾波之后的信號;閾值為特征值的平均值');
d=diag(S(1:N,1:N));
for i=1:N
if d(i)<=median(d)
d(i)=0;
end
end
stemp=S;
stemp(1:8,1:8)=diag(d);
Sf=U*stemp*V';
subplot(224);plot(Sf(1,:));
title('濾波之后的信號;閾值為特征值的中值');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -