資源簡介
是關(guān)于自適應(yīng)濾波器的列子,matlab實現(xiàn)。可以運行。適合初學(xué)者

代碼片段和文件信息
%雙頻陷波器
%%%?改變第一級濾波器參考輸入的幅值由1→2?%%%
clear?all
clc
?
N=2000;?????????????????????%總采樣長度
t=linspace(02N);?
s=10*sin(4*pi*t);???????????%原始正弦信號???????????????????
n1=3*sin(100*pi*t);?????????%50Hz干擾信號
n2=5*sin(50*pi*t);??????????%25Hz干擾信號
x=s+n2+n1;??????????????????%引入正弦雙頻干擾的原始輸入
x1=2*cos(100*pi*t);?????????%參考輸入1
x2=2*sin(100*pi*t);?????????%參考輸入2
w1=0.1;
w2=0.1;?????????????????????%權(quán)矢量初值
e1=zeros(1N);
y1=0;
u=0.01;??????????????????
for?i=1:N???????????????????%LMS算法
????y1=w1*x1(i)+w2*x2(i);
????e1(i)=x(i)-y1;?
????w1=w1+u*e1(i)*x1(i);?
????w2=w2+u*e1(i)*x2(i);?
end
x1=cos(50*pi*t);
x2=sin(50*pi*t);
w1=0.1;
w2=0.1;??
e2=zeros(1N);
y2=0;
for?i=1:N???????????????????%LMS算法
????y2=w1*x1(i)+w2*x2(i);
????e2(i)=e1(i)-y2;?
????w1=w1+u*e2(i)*x1(i);?
????w2=w2+u*e2(i)*x2(i);?
end
figure(1)?
subplot(211);
plot(ts);
title(‘原始正弦信號‘);
axis([0?2?-20?20]);
subplot(212);?
plot(tx);
title(‘加入雙頻干擾的原始信號‘);
figure(2)
subplot(311);
plot(ts+n2);
title(‘1級自適應(yīng)陷波器輸出理論值‘);
subplot(312);
plot(te1);
title(‘1級自適應(yīng)陷波器輸出實驗值‘);
subplot(313);
plot(ts+n2-e1);
title(‘1級信號誤差‘);
figure(3)
subplot(311);
plot(ts);
title(‘2級自適應(yīng)陷波器輸出理論值‘);
axis([0?2?-20?20]);
subplot(312);
plot(te2);
title(‘2級自適應(yīng)陷波器輸出實驗值‘);
subplot(313);
axis([0?2?-1?1]);
plot(ts-e2);
title(‘2級信號誤差‘);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1022??2010-01-23?17:30??single?frequency--different?u.m
?????文件???????1499??2010-01-23?17:32??double?frequency--change?first?noise?amplitude.m
?????文件???????1067??2010-01-23?17:31??single?frequency--different?△?f.m
?????文件???????1013??2010-01-25?10:23??single?frequency--different?amplitude.m
?????文件???????1013??2010-01-25?10:55??single?frequency--different?Fudu.m
?????文件???????1022??2010-01-23?17:31??single?frequency--different?theta.m
-----------?---------??----------?-----??----
?????????????????6636????????????????????6
- 上一篇:MATLAB期末論文
- 下一篇:內(nèi)彈道求解程序
評論
共有 條評論