How to get to Power Spectral Density from Power spectrum as shown in figure
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
fsine=10e6;
L=10;
PS=0.2;
A=7.85e-11;
c=3e8;
dt=2e-12;
V=1;
n=1.45; %Index of refraction
eps0=8.854e-12; % [F/m] Vacuum permittivity
T=10*2*L*n/c; %Total time
Nt=round(T/dt);
t = (-T/2/dt:1:T/2/dt)*dt; %time axis
nu=(-1/2/dt:1/T:1/2/dt); %frequency axis
I1_0=PS/A;
sine = V*sin(2*pi*fsine*t); %phase modulation condition
phi=sine;
ES_0t=sqrt(I1_0/2/n/c/eps0)*exp((1i*(pi)*phi)); % Original signal in time
Power=trapz(t,2*n*c*eps0*A*abs(ES_0t).^2)/T; % Area under the curve in time domain
FFt_EL0t=fftshift(abs(fft(ES_0t/Nt))); % fourier transform of the original signal
Power_FFt=T*trapz(nu,2*n*c*eps0*A*(FFt_EL0t).^2); % Area under the curve in frequency domain
figure;plot(nu,10*log10(2*n*c*eps0*A*(FFt_EL0t).^2)./1e-3);
xlim([-100e6 100e6]);
ylabel('Power[dBm]');
xlabel('frequency[Hz]');
The idea was to obtain PSD exactly like the second figure but I cannot understand what to change in the above code.I have converted Power units from W to dBm but evidently that is of no use.
Any suggestions will be greatly appreciated.
Thank you
0 commentaires
Réponses (1)
dpb
le 19 Sep 2024
Modifié(e) : dpb
le 19 Sep 2024
fsine=10e6;
L=10;
PS=0.2;
A=7.85e-11;
c=3e8;
dt=2e-12;
V=1;
n=1.45; %Index of refraction
eps0=8.854e-12; % [F/m] Vacuum permittivity
T=10*2*L*n/c; %Total time
Nt=round(T/dt);
t = (-T/2/dt:1:T/2/dt)*dt; %time axis
nu=(-1/2/dt:1/T:1/2/dt); %frequency axis
I1_0=PS/A;
sine = V*sin(2*pi*fsine*t); %phase modulation condition
phi=sine;
ES_0t=sqrt(I1_0/2/n/c/eps0)*exp((1i*(pi)*phi)); % Original signal in time
Power=trapz(t,2*n*c*eps0*A*abs(ES_0t).^2)/T; % Area under the curve in time domain
FFt_EL0t=fftshift(abs(fft(ES_0t/Nt))); % fourier transform of the original signal
Power_FFt=T*trapz(nu,2*n*c*eps0*A*(FFt_EL0t).^2); % Area under the curve in frequency domain
figure;
semilogy(nu/1E6,2*n*c*eps0*A*(FFt_EL0t).^2);
xlim([-1 1]*1E2)
ylabel('Amplitude');
xlabel('frequency [MHz]');
will scale to log y axis. Nothing can do about the shape of the spectrum; that's wholly dependent upon the characteristics of the time trace.
0 commentaires
Voir également
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!