信号时域处理包括的主要内容

• 相干平均算法

$\bar{y}(t)=\frac{1}{N} \sum_{i=1}^{N} y_{i}(t)=\frac{1}{N} \sum_{i=1}^{N}\left[s(t)+n_{i}(t)\right]=s(t)+\frac{1}{N} \sum_{i=1}^{N} n_{i}(t)$.

clc
clear all
t=1:1024;
phi=2.15;
N=500;%Number of signals
omeag=(2*pi)*0.0050;
x=sin(omeag*t+phi);%initial signal
for i=1:N
y(i,:)=x+3*randn(1,length(t));
noise(i,:) =  3*randn(1,length(t)); %signals with random noises
end

figure(1)
subplot(1,3,1)
plot(x)
xlim([0 1024])
title('原始信号')
subplot(1,3,2)
plot(t,noise(1,:)); xlim([0 1024]); title ('噪声信号')
subplot(1,3,3)
plot(t,y(1,:),'b'); xlim([0 1024]);
title('被淹没在噪声中的信号')
MeanY=mean(y);%Mean of the random signals
figure(2)
subplot(1,2,1);
plot(mean(noise));
xlim([0 1024]), title ('平均噪声信号')
subplot(1,2,2);
plot(t,MeanY, 'r', t, x, 'k');
xlim([0 1024]);
legend('噪声平均后混合信号', '原始信号')
title('相干平均处理后的信号')


• 相干技术

$r_{xy}(m)=\sum_{n=-\infty}^{\infty}x(n)y(n+m),$m取任意整数，上式表示的相关运算，是两数字序列(digital sequences)的对应项的相乘再相加的运算。计算完一次，序列$y(n)$左移一位。式中m表示位移量，每取一个m得一个$r_{xy}$值，如$r_{xy}(0)$$r_{xy}(1)$,...,$r_{xy}(N-1)$共有N个值，+m表左移-m表右移，共有2N-1个值。这2N-1个值就构成了互相关序列（cross-correlation sequence）叫互相关函数。r值大于0表示有同相成份存在，小于0表示有反相成分存在。等于0表示两序列正交或相互独立。

Plot the autocorrelation sequence of a sinewave with
frequency 1 Hz, sampling frequency of 200 Hz.

N=1024; % Number of samples
f1=1; % Frequency of the sinewave
FS=200; % Sampling Frequency
n=0:N-1; % Sample index numbers
x=sin(2*pi*f1*n/FS); % Generate the signal, x(n)
t=[1:N]*(1/FS); % Prepare a time axis
subplot(2,1,1); % Prepare the figure; plot(t,x); % Plot x(n)
title('Sinwave of frequency 1Hz [FS=200Hz]');
xlabel('Time, [s]');ylabel('Amplitude');grid;
Rxx=xcorr(x); % Estimate its autocorrelation
subplot(2,1,2); % Prepare the figure; plot(Rxx); grid;
title('Autocorrelation function of the sinewave');
xlable('lags'); ylabel('Autocorrelation');                                               

因此，我们以带有噪声的信号自相干为例，有：

%Exam 自相关函数
clear all; clc
f0=0.1;
t=1:1/f0:1024;
N=500;%Number of signals
f=0.003; phi=0;
x0=sin(2*pi*f*t+phi);%initial signal
y0=randn(1,length(t));
y=x0+y0;%signals with random noises
figure(1)
subplot(3,2,1)
plot(t,x0)
title('原始信号x_0')
subplot(3,2,3)
plot(t,y0)
title('噪声信号y_0')
subplot(3,2,5)
plot(t,y)
title('原始信号+噪声信号')
T=(1:2*length(t)-1)/(f0);
Xx0=xcorr(x0,'unbias');
subplot(3,2,2)
plot(T,Xx0)
title('原始信号自相关')
Xy0y0=xcorr(y0,y0,'unbias');
subplot(3,2,4)
plot(T,Xy0y0)
title('噪声信号自相关')
Xyy=xcorr(y,y,'unbias');
subplot(3,2,6)
plot(T,Xyy)
title('含噪声的信号自相关')


%Exam4_2_2 自相、互相关关函数
clc
clear all
t=1:1024;
phi=2.15;
N=500;%Number of signals
omeag=(2*pi)*0.0050;
x0=sin(omeag*t+phi);%initial signal
y0=5*randn(1,length(t));
y=x0+y0;%signals with random noises
figure(1)
subplot(1,2,1)
plot(x0)
title('原始信号x_0')
subplot(1,2,2)
plot(y0,'b')
title('噪声信号y_0')
Xx0=xcorr(x0,'unbias');%原始信号自相关
Xx0y0=xcorr(x0,y0,'unbias');%与噪声信号的互相关
Xx0y=xcorr(x0,y,'unbias');%原始信号与带有噪声的信号互相关
figure(2)
subplot(1,2,1)
plot(y)
title('被淹没在噪声中的信号y—原始信号x_0+噪声信号y_0')
subplot(1,2,2)
plot(1:length(Xx0),Xx0,'.b',1:length(Xx0y),Xx0y,'r',
1:length(Xx0y0),Xx0y0,'k')
title('相关技术分析处理结果')
text(1030,Xx0(1030),'\leftarrow Xx0','color','b',...
'HorizontalAlignment','left')
text(1300,Xx0y(1300),'\leftarrow x0y','color','r',...
'HorizontalAlignment','left')
text(800,Xx0y0(800),'\leftarrow x0y0','color','k',...
'HorizontalAlignment','left')


12-01

01-04 3565
03-13 2万+
11-14 1万+
12-10 1万+
01-27
05-09
11-08 4531
05-09
08-15 5695
01-20 1万+
09-28
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客