how to determine the SNR using Matlab function in simulink ?

24 views (last 30 days)
i want to generate the Matlab Function code in simulink that :
1-conver the signal from time domain to frequency domain by using fft
2- plot the frequency domian in dB
3- calculate the SNR of the signal

Answers (1)

Kanishk
Kanishk on 6 Sep 2024
Hi Anas,
I understand you want to convert a signal from time domain to frequency domain. You can use MATLAB’s ‘fft’ function.
You can go through this official MATLAB documentation to transform a signal between time and frequency domain.
To plot the frequency domain in decibels, you can use this formula to convert the signal into decibels.
Y = fft(X, N);
Y = abs(Y(1:N/2+1));
fftResult_dB = 20 * log10(Y);
Here is a MATALAB answer on how to transform the data to decibels and plot it.
To calculate the signal to noise ratio of the signal you can use MATLAB’s “snr” function. After creating a function, you can add it to Simulink using “MATLAB function block” as both “fft” and “snr” functions are supported by the block.
Please refer to the official MATLAB documentation of the “snr” function and “MATLAB function” block to learn more about them.
Hope this helps!!
Thanks

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!