Clear Filters
Clear Filters

How to find RMS bandwidth of the below signal

33 views (last 30 days)
L=10;
n=1.45;
c=2.9979e8;
dt=6e-12;
T=10*2*L*n/c;
fmax =2.5e9
fmax = 2.5000e+09
%fs=80*fmax;
TA=-T/2:dt:T/2;
fs=1/dt;
%t = (-T/2/dt:1:T/2/dt)*dt;
Nt=round(T/dt);
vsine = 1;
phi = vsine*sin(2*pi*fmax*TA);
EL1t=1.274e7*exp(1i*phi);
%plot(TA,(EL1t));
%FA = ((0:Nt-1)-floor(Nt/2))/Nt*fs;
FA = (-Nt/2:Nt/2-1)/Nt*fs;
FP=fft(phi);
%fs=1/dt/Nt;
Z=plot(FA,fftshift(abs(fft(EL1t/Nt))));
I want to find the RMS linewidth of the above signal and the formula for it is given here , but I am confused how to implement it in the code.
  1 Comment
dpb
dpb on 22 Jun 2024
Edited: dpb on 22 Jun 2024
Let's get a better picture of what the result actually is...
L=10;
n=1.45;
c=2.9979e8;
dt=6e-12;
T=10*2*L*n/c;
fmax =2.5e9;
fmax = 2.5000e+09;
%fs=80*fmax;
TA=-T/2:dt:T/2;
fs=1/dt;
%t = (-T/2/dt:1:T/2/dt)*dt;
Nt=round(T/dt);
vsine = 1;
phi = vsine*sin(2*pi*fmax*TA);
EL1t=1.274e7*exp(1i*phi);
%plot(TA,(EL1t));
%FA = ((0:Nt-1)-floor(Nt/2))/Nt*fs;
FA = (-Nt/2:Nt/2-1)/Nt*fs;
FP=fft(phi);
%fs=1/dt/Nt;
Z=plot(FA,fftshift(abs(fft(EL1t/Nt))));
set(gca,'YScale','log')
OK, it is all positive; what have you tried so far to simply translate the formula into MATLAB code?
At least make an attempt here...it appears it should be about a two-three line exercise -- note the difference in MATLAB between the "dot" operator times, .* and mtimes, *

Sign in to comment.

Accepted Answer

Chandrika
Chandrika on 4 Jul 2024 at 10:20
Hello Yogesh,
From your code, I could understand that 'FA' is the Frequency vector computed using sampling frequency 'fs' and the number of time samples 'Nt'
Further, in order to implement the formula to compute RMS linewidth in your given code, you may refer the sample code I am attaching below:
L=10;
n=1.45;
c=2.9979e8;
dt=6e-12;
T=10*2*L*n/c;
fmax =2.5e9;
fmax = 2.5000e+09;
TA=-T/2:dt:T/2;
fs=1/dt;
Nt=round(T/dt);
vsine = 1;
phi = vsine*sin(2*pi*fmax*TA);
EL1t=1.274e7*exp(1i*phi);
% Frequency vector computed
FA = (-Nt/2:Nt/2-1)/Nt*fs;
% FFT of the signal copmuted and normalized
EL1t_fft = fft(EL1t) / Nt;
% Power computed
Pow = abs(fftshift(EL1t_fft)).^2;
% Computing rms_linewidth as per the formula
rms_linewidth = 2*(sqrt(sum((FA).^2 .* Pow) / sum(Pow)));
Here, 'Pow' indicating the Power has been calculated premised upon the idea that Power is the squared magnitude of a signal's Fourier transform, normalized by the number of frequency samples as could be found in this documentation: https://in.mathworks.com/help/matlab/math/fourier-transforms.html
I hope you find the above provided workaround useful!
Regards,
Chandrika

More Answers (0)

Community Treasure Hunt

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

Start Hunting!