- '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!