Plotting phase noise vs offset frequency of an optoelectronic oscillator...

21 次查看(过去 30 天)
I have generated a 10GHz optoelectronic oscillator using an optical simulation tool (I have extracted the 10 GHz-oscillation signal in a span of 20GHz from the actual data, as shown in the first plot). I am trying to find the phase noise (dBc/Hz) vs frequency offset (Hz) and display it in a graph. However, the calculation does not display any value/curve for the offset frequencies below ~10e7.
Can you help me figure it out and hint at what I am doing wrong? I'm lost...
PS: If you have used the phaseNoiseMeasure method, you can give it a try... Hopefully that will help as well.
I have also tried to reduce the frequency range to 9GHz to 11Ghz, but that did not help either...
load OptoelectronicOscillator.mat
% Plot frequency and power data
figure;
plot(x, y);
xlabel('Frequency (Hz)');
ylabel('Power (dBm)');
title('Frequency vs Power');
grid on;
% Convert power from dBm to linear scale (Watts)
power_linear = 10.^(y/10);
% Calculate phase noise
delta_f = mean(diff(x)); % Calculate frequency spacing
if delta_f <= 0
error('Frequency data is not properly sorted or spaced.');
end
phase_noise = 10 * log10(abs(gradient(power_linear, delta_f))); % Convert to dBc/Hz
% Define the frequency range of interest
freq_range = x >= 10 & x <= 1e9 + 10e9;
% Plot phase noise vs frequency offset within the defined range
figure;
semilogx(x(freq_range) - 10e9, phase_noise(freq_range));
% or
% semilogx(x - 10e9, phase_noise);
xlabel('Frequency Offset (Hz)');
ylabel('Phase Noise (dBc/Hz)');
title('Phase Noise vs Frequency Offset');
grid on;
% Set axis limits
xlim([1 1e9]); % Frequency offset from 1Hz to 1GHz
ylim([-180 -40]); % Phase noise from -40dBc/Hz to -180dBc/Hz
% Debugging
disp(['Mean frequency spacing: ', num2str(delta_f)]);
Mean frequency spacing: 39062500
disp(['Min phase noise: ', num2str(min(phase_noise))]);
Min phase noise: -195.3878
disp(['Max phase noise: ', num2str(max(phase_noise))]);
Max phase noise: -69.1751

回答(1 个)

Mathieu NOE
Mathieu NOE 2024-3-26
hello
the main problem is that your data has a very coarse frequency resolution
so if I remove the content below 10GHz , remains only 0 then 0 + delta_f = 39062500 Hz, etc ... , so there is simply no y data to display below 39062500 Hz
I tried to implement some interpolation, but when there is no data available, well even matlab cannot create it ex nihilo
you need a much refined frequency resolution to get something that looks like the picture you posted above
load OptoelectronicOscillator.mat
% Plot frequency and power data
figure;
plot(x, y);
xlabel('Frequency (Hz)');
ylabel('Power (dBm)');
title('Frequency vs Power');
grid on;
% return
% Convert power from dBm to linear scale (Watts)
power_linear = 10.^(y/10);
% Calculate phase noise
delta_f = mean(diff(x)); % Calculate frequency spacing
if delta_f <= 0
error('Frequency data is not properly sorted or spaced.');
end
phase_noise = 10 * log10(abs(gradient(power_linear, delta_f))); % Convert to dBc/Hz
% Define the frequency range of interest
[m,ind] = max(y);
f_central = x(ind);
% focus on range between 10^2 (a = 2) and 10^10 (b = 10) above f_central
a = 2;
b = 10;
freq_range = x >= f_central & x <= f_central + 10^b;
% Plot phase noise vs frequency offset within the defined range
xx = x(freq_range) - f_central;
pn = phase_noise(freq_range);
% do some linear interpolation on log spaced x values
xnew = logspace(a,b,100);
pn_new = interp1(xx,pn,xnew);
figure;
semilogx(xx, pn,'b*',xnew, pn_new,'r');
xlabel('Frequency Offset (Hz)');
ylabel('Phase Noise (dBc/Hz)');
title('Phase Noise vs Frequency Offset');
grid on;
% Set axis limits
% xlim([1 1e9]); % Frequency offset from 1Hz to 1GHz
% ylim([-180 -40]); % Phase noise from -40dBc/Hz to -180dBc/Hz
% Debugging
disp(['Mean frequency spacing: ', num2str(delta_f)]);
Mean frequency spacing: 39062500

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by