Chan_Loss = 1;
y_mod_am_chan = y_am_mod/Chan_Loss; % signal after channel attenuation/loss
% a_int_sig = 5e-2; % amplitude of interference signals
% f_int_sig = [10e3, 20e3, 25e3, 32e3, 40e3]; % frequencies of interference signals
% int_sig = a_int_sig*sin(2*pi*f_int_sig(1)*time');
% for f_int = f_int_sig(2:end)
% int_sig = int_sig + a_int_sig*sin(2*pi*f_int*time');
% end
signal_power = std(y_mod_am_chan); % Signal Power
noise_power = 0.01*signal_power; % noise power
noise_sig = randn(no_of_pnts, 1)*noise_power; % noise signal generated based on normal distribution
y_mod_am_int = y_mod_am_chan; % received signal with interference signals
You need to geneterate the same plots for all noise powers (0.01, 0.1, 0.5, and 1 times the received signal power at the receiver).
Basically you need to change the coefficient value in
noise_power = 0.01*signal_power; % noise power
line in your channel section.

 채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2024년 1월 6일

0 개 추천

If understood correctly, what you are trying to attain is to generate a few different noise powers from the given signal. If so, then
t = (0:0.05:10)';
x = sin(t);
SNR = [0.01, 0.05, 0.1, 1, 10, 50];
LC = 'kbmgck';
for ii = 1:numel(SNR)
% White noise is generated with awgn():
y_noise = awgn(x,SNR(ii), 'Measured'); % Assumes that the input signal power value in dBW
figure(ii)
plot(t,x, 'r',"LineWidth",2, "DisplayName",'Measured data')
hold on
plot(t,y_noise, LC(ii), 'LineWidth', 1.25, "DisplayName",'Noise added signal')
title(['SNR Level is ' num2str(SNR(ii)) ' dB'])
legend('Show')
end

댓글 수: 6

Matt
Matt 2024년 1월 6일
That is beautiful. Thank you so much.
Matt
Matt 2024년 1월 7일
On the line for ii = 1:numel(SNR) it comes up with the warning: Negative data ignored.
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2024년 1월 7일
Most welcome! Glad to be of some help :) Please vote for Thumbs UP :)
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2024년 1월 7일
Check your typed in code carefully. It should not produce any warning. Note that numel() does not care about negative or positive values. It counts how many elements in the array.
Matt
Matt 2024년 1월 7일
@Sulaymon Eshkabilov it still does the same issue
Matt
Matt 2024년 1월 7일
@Sulaymon Eshkabilov nevermind, it completely works :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

태그

질문:

2024년 1월 6일

댓글:

2024년 1월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by