How to get to Power Spectral Density from Power spectrum as shown in figure
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
dpb
2024년 9월 19일
편집: dpb
2024년 9월 19일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!