matlab 信号处理

来源:百度知道 编辑:UC知道 时间:2024/05/13 12:05:33
􀁺 Q2: Consider the sinusoid signal
x(k)=sin(π/4k)+n(k)
that is corrupted by random noise, n(k).
Using MATLAB or C, show that
averaging the signal removes the noise
component and reveals the
deterministic component. Show results
for 1, 10, and 100 averages.

hi, maybe this could help.
---------------------------
clc;
clear all;
close all;
k = 0:0.05:10;
x=sin((pi/4).*k)+0.05*randn(size(k)); ;
plot(k,x);

winsize=10;
%winsize=1;
%winsize=100;

for i=1:length(x)-winsize+1;
x2(i)=mean(x(i:i+winsize-1));
end

hold on;
k2=0.05*(winsize/2):0.05:10-0.05*(winsize/2-1);
plot(k2,x2,'r');