Averaging a process over a certain number of cycles
조회 수: 4 (최근 30일)
이전 댓글 표시
Hey,
Essentially, this is a transmit receive system. I transmit a signal, an attenuated and time shifted copy acts as the 'reflected signal' and I immerse this reflected signal in white gaussian noise. I then perform a matched filter on the receive channel (reflected signal + noise) by cross correlating it with the transmitted signal. However, since the noise is generated differently every time I run the script, I would like to repeat this process over X cycles and then average. Below is the section of the code where I think it should be implemented. plsreflatt is the signal vector and it gets added to gaussian noise r to form the vector rplsnoise. It then gets cross correlated with the initial transmission. Any help on how to do this averaging would be greatly appreciated! Thank you!
att=0.05;
plsreflatt=(att*refl)';
noisepeak = 0.1;
stdev=noisepeak/3;
%Generation of white Gaussian noise
r = randn(size(taxes))*stdev;
rplsnoise = r + plsreflatt;
[Amp,Time] = xcorr(rplsnoise,transmission);
%Inequalities included to plot values only above 0
Amp = Amp(Time>=0);
TimeF = Time(Time>=0)/sample_freq;
댓글 수: 0
답변 (1개)
Anurag
2023년 10월 25일
Hi Felipe,
I understand that you want to average the result of your process over some finite cycles, please refer to the modified code below for achieving the desired results:
% Define the number of cycles you want to average over
X = 100; % Replace with your desired number of cycles
% Initialize arrays to accumulate results
accumulated_Amp = zeros(1, length(Time));
num_cycles = 0;
% Repeat the process X times
for cycle = 1:X
att = 0.05;
plsreflatt = (att * refl)';
% Generate white Gaussian noise
r = randn(size(taxes)) * stdev;
rplsnoise = r + plsreflatt;
[Amp, Time] = xcorr(rplsnoise, transmission);
% Inequalities included to plot values only above 0
Amp = Amp(Time >= 0);
% Accumulate results
accumulated_Amp = accumulated_Amp + Amp;
num_cycles = num_cycles + 1;
end
% Calculate the average
average_Amp = accumulated_Amp / num_cycles;
% Now, you can work with the average_Amp for further analysis or plotting.
Hope this helped,
Regards,
Anurag
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Pulsed Waveforms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!