MASHIII调制器MASHIII调制器的Simulink建模与仿真
Posted fpga&matlab
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MASHIII调制器MASHIII调制器的Simulink建模与仿真相关的知识,希望对你有一定的参考价值。
1.软件版本
MATLAB2021a
2.本算法理论知识
这里,基于小数分频的频率合成器,考虑到你需要实现sigma-delta以及mash等结构。因此,系统的模块结构如下图所示:
下面,我们对这个结构图进行SIMULINK建模。
1.鉴相器采用XOR模块设计。
2.环路滤波器结构如下:
这里通过一个低通滤波器进行设计。
3.压控振荡器的设计,
上述几个模块都是可以通过现成的模块进行搭建,
3.核心代码
clc;
close all;
warning off;
window = hann(length(yout));
[Pyy,w] = periodogram(yout,window,100000);
PSD2 = 1/M+1/100*(2*(w)).^4;
Len = length(PSD2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure;
semilogx(w/pi,10*log10(pi*Pyy),'b');
hold
semilogx(w(Len/100:Len)/pi,10*log10(PSD2(Len/100:Len)),'k','linewidth',2);
grid on
xlabel('Normalized Frequency (x\\pi rad/sample)')
ylabel('Power/frequency(dB/rad/sample)');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure;
plot(yout,'linewidth',2);
grid on;
xlabel('times');
ylabel('sigmadelta调制器输出');
grid on
figure;
hist(yout,5)
xlabel('output yout')
ylabel('number of occurance');
figure;
plot(yout2(1:3*Len/4),'linewidth',2);
grid on;
xlabel('times');
ylabel('V');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%分析频率稳定度
Fre = yout3;
K = 1;
t1 = yout3(1:end-K);
t2 = yout3(K+1:end);
Err = abs(t1-t2)./t1;
figure;
loglog(Err,'linewidth',2);
grid on;
xlabel('times');
ylabel('频率稳定度');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%最后进行杂散分析
N = 16; %累加器的位数;
K = fix((2^N)*0.2); %频率控制字,即累加的步长;
D = 8; %8bit DAC
g = gcd(K,2^N);
pe = 2^N/(g);
n = 1:pe;
pp = pe+1; %频谱分析点数
add_y = mod(n*K,2^N); %累加器的输出表达式;
%设定量化区间
pat = -1 + 1/ (2^ (D - 1) ):1/ (2^ (D - 1) ):1 - 1/ (2^ (D -1) );
%设定量化码本值
codebook = -1 + 1/ (2^D):1/ (2^(D - 1) ) :1 - 1/ (2^D);
rom_x = cos(2*pi*add_y/(2^N));
[index,quants2] = quantiz(rom_x,pat,codebook);
[Pzz,wz] = periodogram(quants2,[],'onesided',pp);
figure;
psdplot(Pzz/max(Pzz),wz);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4.操作步骤与仿真结论
5.参考文献
A37-01
6.完整源码获得方式
方式1:微信或者QQ联系博主
方式2:订阅MATLAB/FPGA教程,免费获得教程案例以及任意2份完整源码
以上是关于MASHIII调制器MASHIII调制器的Simulink建模与仿真的主要内容,如果未能解决你的问题,请参考以下文章