如何用MATLAB编写FIR维纳滤波器,最佳FIR维纳滤波器实现

如何用MATLAB编写FIR维纳滤波器,最佳FIR维纳滤波器实现本实验中利用近似方法 即最佳 FIR 维纳滤波方法 在计算机上实现随机信号的维纳滤波 w n 是零均值 方差为 1 a 2 的均匀分布白噪声 s n 为真实信号 s n a s n 1 w n v n 是与 s n 互不相关的均匀分布白噪声 其均值为零 方差为 1 x n 为接收到的添加了白噪声的信号 x s v si n 为使用理想维纳滤波器滤波得到结果 y n 为使

% 本实验中利用近似方法,即最佳FIR维纳滤波方法,在计算机上实现随机信号的维纳滤波。

% w(n)是零均值,方差为(1-a^2)的均匀分布白噪声

% s(n)为真实信号:s(n)=a*s(n-1)+w(n)

% v(n)是与s(n)互不相关的均匀分布白噪声,其均值为零,方差为1

% x(n)为接收到的添加了白噪声的信号:x = s + v

% si(n) 为使用理想维纳滤波器滤波得到结果

% y(n) 为使用近似FIR维纳滤波器滤波得到的结果

% If you have any problem, please email me:

% This program is written by QiJiaxing

% 2009.11.20

clc

clear all

L = 500;  % signal length

N = 20;  % length of the FIR

filter

a = 0.95;

% white noise with mean of 0 and var of (1-a^2)

w =  sqrt( 12 * (1 – a^2)) * ( rand(1,L) –

0.5 );

% true signal: s(n)=a*s(n-1)+w(n)

s = zeros(1,L); s(1) = w(1);

for ii = 2:L

s(ii) =

a * s(ii-1) + w(ii);

end

% white noise with mean of 0 and var of 1

v =  sqrt( 12 ) * ( rand(1,L) – 0.5 );

% received signal: x = s + v

x = s + v;

%  r_xx is the autocorrelation of x

r_xx = xcorr( x );

% R_xx is the N-dimentional autocorrelation matrix of x

R_xx = zeros( N );

for ii = 1 : N

R_xx( :

, ii ) = r_xx( L+1-ii : L+1-ii+N-1 )’;

end

%  r_xs is the cross-correlation of x and

s

r_xs = xcorr( x , s );

r_xs = r_xs( L : L+N-1 )’;

% according to R_xx * h_FIR = R_xs

% we can calculate the h_FIR

h_FIR = inv(R_xx) * r_xs;

h_FIR = h_FIR’;

% y is the reslut signal filtered by h_FIR

y = cconv( h_FIR , x, L );

% si is the result signal filtered by ideal Wiener filter

h

n = 0:L-1;

h = 0.238 * ( 0.724 .^ n );

si  = cconv( h , x, L );

%% plot the true signal s(n) and the received signal x(n) of

the last 100

% points

t = L – 99 : L;

figure(1);

plot( t , x(t), ‘–b’ , t , s(t) , ‘r’ );

legend( ‘x(n)’ , ‘s(n)’ , 0 );

title(‘The true signal s(n) and the received signal

x(n)’);

xlabel(‘n’);ylabel(‘Signal Amplitude’);

%% plot the ideal impulze response h(n) and the FIR impulze

response

% h_FIR(n) of N points

n = 1:N;

figure(2);

plot( n,h(n),’–b’,n,h_FIR(n),’r’ );

legend(‘The Ideal Wiener Filter h(n)’,’Approximate FIR Filter

h\_FIR(n)’,0);

title(‘The Impulze Response of Ideal Wiener Filter h(n) and

the Impulze Response h\_FIR(n)’);

xlabel(‘N points’);ylabel(‘Amplitude’);

%% plot the true signal s(n) and the result signal y(n)

filtered by

% h_FIR

figure(3);

plot( t, s(t), ‘–b’, t, y(t), ‘r’ );

legend(‘True Signal s(n)’,’Result Signal y(n)’,0);

title(‘The True Signal s(n) and The Result Signal y(n) Filter

by h\_FIR’);

xlabel(‘n’);ylabel(‘Signal Amplitude’);

%% plot the true signal s(n) and the result signal si(n)

filtered by h

figure(4);

plot( t, s(t), ‘–b’, t, si(t), ‘r’ );

legend(‘True Signal s(n)’,’Result Signal si(n)’,0);

title(‘The True Signal s(n) and The Result Signal si(n)

Filtered by h’);

xlabel(‘n’);ylabel(‘Signal Amplitude’);

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/230163.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月16日 下午2:59
下一篇 2026年3月16日 下午2:59


相关推荐

  • 超详细kali linux 设置固定IP地址步骤

    超详细kali linux 设置固定IP地址步骤kalilinux设置固定IP地址二,设置虚拟网络    &…

    2022年5月9日
    723
  • 冒泡排序(java代码实现)

    冒泡排序(java代码实现)冒泡排序和快速排序1、冒泡排序1.1介绍1.2代码实现1.2.1基本实现1.2.2优化2、快速排序2.1介绍2.2代码实现1、冒泡排序1.1介绍1.2代码实现1.2.1基本实现1.2.2优化2、快速排序2.1介绍2.2代码实现…

    2022年6月22日
    29
  • 新版本 Cursor rules .mdc格式文件使用经验分享

    新版本 Cursor rules .mdc格式文件使用经验分享

    2026年3月16日
    2
  • leetcode数组汇总_leetcode经典题

    leetcode数组汇总_leetcode经典题原题链接给定一个由整数数组 A 表示的环形数组 C,求 C 的非空子数组的最大可能和。在此处,环形数组意味着数组的末端将会与开头相连呈环状。(形式上,当0 <= i < A.length 时 C[i] = A[i],且当 i >= 0 时 C[i+A.length] = C[i])此外,子数组最多只能包含固定缓冲区 A 中的每个元素一次。(形式上,对于子数组 C[i], C[i+1], …, C[j],不存在 i <= k1, k2 <= j 其中 k1 % A.leng

    2022年8月8日
    8
  • 怎么新建pytest的ini文件_qt读写配置文件

    怎么新建pytest的ini文件_qt读写配置文件前言pytest配置文件可以改变pytest的运行方式,它是一个固定的文件pytest.ini文件,读取配置信息,按指定的方式去运行查看pytest.ini的配置选项pytest-h找到以下

    2022年8月6日
    10
  • origin多组柱状图_柱状图上下两组数据

    origin多组柱状图_柱状图上下两组数据今日份知识你摄入了么?在我的数据分析生涯中,我几乎完全是在SQL中锻炼我的技能。虽然SQL可以做一些非常酷的事情,但它有它的局限性-这些限制在很大程度上让我决定了要不要去感受数据科学别的巨大魅力。在我之前的数据岗位中,我需要分析来自外部源的数据文件和工具,但这些工具限制了它可以处理的数据量或花费过多的时间,使任务变得几乎不可能彻底完成。在我所有职位中有一个数据pipeline有点像这样:…

    2026年4月17日
    6

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号