马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
现在有拟合程序,而且各部分的相位噪声数据也得到了,我得到的是.CSV形式的文件。我遇到的问题是怎么通过这个程序把相位噪声拟合起来,在MATLAB中怎样把这三个部分的数据加进来啊,对MATLAB不是很懂,求大神帮忙了。
Matlab Code for the phase Noise:
% Matlab code for estimating total PLL phase noise
function Phase_Noise(PN_pcl, PN_vco)
PN_div - divider phase noise profile (from Cadence)
PN_pcl - PFD/CP/LPF amplitude noise profile (from Cadence)
PN_vco - VCO phase noise profile (from Cadence)
clear;
fstart=10e3; | % starting at 10kHz | fstep=10e3; | % freq step is 10kHz | fstop=10e6; | % stop freq is 10MHz | f=fstart:fstep:fstop; | % generate frequency vector |
w=2*pi*f;
%%%% PLL Specification %%%%
%
% You will have to change these values to match those of your PLL.
% You will also need to change F, the loop filter transfer function
% to match that of your chosen loopfilter. The current loop filter
% configuration is the simply (R + 1/sC1) || 1/sC2
%
N=244; | % nominal division ratio | Kvco=2*pi*221E6; | % VCO gain | Icp=100E-6; | % charge pump current = 100 uA | Kpd=Icp/(2*pi); | % phase detector gain | R=45E3; | % resistor value | C=70E-12; | % capacitor value | C2=5E-12;
F1 = R + 1./(j*w*C); | % Simple RC loop filter transfer function | F2= (1./((R+1./C./(j*w)).^-1+C2.*(j*w)) ); | % RC | with C2 in parallel. | F3=F2.*F1; | % Combination of F2 cascaded with F1. | F=F2; | % You should try designing and trying different LPFs F1, F2 and F3 and |
see how it affects %the loop response.
%%%% Calculate the Loop Transfer Functions
A = Kpd*F*Kvco./(j*w); % forward gain
B = 1/N; % feedback gain
G=A.*B; % loop-gain TF
H = A./(1+A*B); | % closed-loop TF | E = H.*j.*w./(Kpd*Kvco*F); | % error TF | %Plot the transfer functions
figure;
semilogx(f,20*log10(abs(G))); | % plot loop-gain |
title('Loop-Gain Transfer Function');
grid ON;
figure;
semilogx(f,20*log10(abs(H))); % plot closed-loop TF
title('Closed-Loop Transfer Function');
grid ON;
figure;
semilogx(f,20*log10(abs(E))); % plot error TF
title('Error Transfer Function');
grid ON;
%% Reference phase noise
PN_ref = | -150 | - | 3*log10(f/1000); | % reference phase noise specified in | dB
PN_out_ref = PN_ref + 20*log10(abs(H)); | % output phase noise due to reference | %% Divider phase noise will be neglected.
%% PFD-CP-LPF combination phase noise
PN_out_pcl = PN_pcl + 20*log10(abs(H./(Kpd*F))); | % output phase noise | due to PFD-CP-LPF
%% VCO phase noise
PN_out_vco = PN_vco + 20*log10(abs(E)); | % output phase noise due to VCO | %% Total output | phase noise |
PN_out =
10*log10(10.^(PN_out_ref/10)+10.^(PN_out_pcl/10)+10.^(PN_out_vco/10));
figure;
grid ON;
semilogx(f,PN_out_ref, f,PN_out_pcl, f,PN_out_vco, f,PN_out);
title('Output Phase Noise');
xlabel('Freq (Hz)');
ylabel('Phase Noise (dB)');
text(1e4,-130, ['Phase noise at 10 kHz = ',num2str(PN_out(1))]); | % | Print phase noise totals
text(1e4,-140, ['Phase noise at 500 kHz = ',num2str(PN_out(100))]); | % You | may need to adjust the
text(1e4,-150, ['Phase noise at 10 MHz = ',num2str(PN_out(1000))]); | % |
positioning on these.
axis([min(f),max(f),min(PN_out),max(PN_out)]);
axis 'auto y';
legend('PN_o_u_t_r_e_f','PN_o_u_t_p_c_l','PN_o_u_t_v_c_o','PN_o_u_t'); |