- 'designfilt' function: https://www.mathworks.com/help/signal/ref/designfilt.html
- 'filter' function: https://www.mathworks.com/help/matlab/ref/filter.html
- 'rms' function : https://www.mathworks.com/help/matlab/ref/rms.html
How to calculate the SNR within a given bandwidth.
19 次查看(过去 30 天)
显示 更早的评论
I want to calculate the SNR within a given bandwidth of a generated waveform after introducing awgn to the waveform. The code I am using for generating the waveform and introducing awgn is:
tmWaveGen = ccsdsTMWaveformGenerator("Modulation","BPSK")% CCSDS TM object with defualt properties
bits = randi([0 1], tmWaveGen.NumInputBits,1); % Input information bits
waveform = tmWaveGen(bits);
BW = 12e3; % Typical satellite channel bandwidth
Fsamp = tmWaveGen.SamplesPerSymbol*BW;
seed = randi([0 2^32-1],1,1);
waveform = awgn(waveform, 0.8,'measured',seed); %adding awgn to the waveform
scope = dsp.SpectrumAnalyzer('SampleRate',Fsamp,'AveragingMethod','Exponential');%Displaying the frequency spectrum of the waveform
scope(waveform);
release(scope);
How can I calculate the SNR, noise power and signal power within the specified bandwidth?
0 个评论
回答(1 个)
Balavignesh
2023-9-26
Hi Pako,
As per my understanding, you would like to calculate signal power, noise power, and signal-to-noise ratio(SNR) of the AWGN waveform within the specified bandwidth.
I would suggest you to design a 'bandpass filter' with the desired bandwidth, sampling frequency, and filter order using the MATLAB function 'designfilt'.
You can filter the waveform from the filter created before using the MATLAB function 'filter'. Singal power and noise power can be determined by calculating the 'rms' value of the respective waveforms using the MATLAB function 'rms'.
SNR can be calculated from the below mentioned formula by calculating the signal and noise powers:
snr = 10 * log10(signal_power / noise_power);
Here is an example showing how you can do this:
% Generating the waveforms. This is a sample waveform.
t = (0:0.1:60)';
waveform = sawtooth(t);
waveform_with_noise = awgn(waveform, 0.8,'measured'); %adding awgn to the waveform
% Design of bandpass filter
fs = 1000; % Sampling Frequency
fpass = [1 400]; % Lower and upper cutoff frequencies
filterOrder = 10; % Filter Order
bpFilter = designfilt('bandpassfir', 'FilterOrder', filterOrder, 'CutoffFrequency1', fpass(1), 'CutoffFrequency2', fpass(2), 'SampleRate', fs);
% Filtering waveforms with bandpass filter
filteredwaveform = filter(bpFilter , waveform);
filteredwaveform_with_noise = filter(bpFilter , waveform_with_noise);
% Calculating Signal Powers
signal_power = rms(filteredwaveform)
noise_power = rms(filteredwaveform_with_noise - filteredwaveform)
% Determine the SNR from signal and noise powers
snr = 10 * log10(signal_power / noise_power)
Please refer to the following documentation links for more information on:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!