我大概讲一下实现的原理:正弦波移相φ,当使得大于sin(φ)的值为1,其他值为-1,占空比就跟这个φ值之间有联系. 占空比原理图如下所示. 结果上图,可以实现调节占空比,方波频率,方波个数. 下面是函数的代码: function y=squarewav(Vm,f,K,n) %参数为幅度,频率,占空比,以及波形个数 % 正弦信号 % f = 1000;% 正弦波频率 w = 2*pi*f;% 正弦波角频率 % Vm = 2;% 正弦幅值 u = (0.5-K)*pi;% 相位 N = 4000;%
x=:*pi; :: s=; ::step s = s+/i*sin(i*x); end plot(s);set(figure(),'visible','off'); filename=[num2str(step, '%04d'),'.png']; print(, '-dpng',filename); end
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem 7.25 \n\n'); ba
用match-z方法,将模拟低通转换为数字低通 代码: %% ------------------------------------------------------------------------ %% Output Info about this m-file fprintf('\n***********************************************************\n'); fprintf(' <DSP using MATLAB> Problem
代码: function y = circonvt(x1,x2,N) %% N-point Circular convolution between x1 and x2: (time domain) %% ------------------------------------------------------------------ %% [y] = circonvt(x1,x2,N) %% y = output sequence containning the circular convo
1.sdc文件也是要添加到Quartus 软件中,这样在执行Read SDC File命令时才能读到相应的文件. 2.在TimeQuest打开的条件下,重新编译工程之后要Update Timing Netlist,这样TimeQuest分析器会得到最新的 网表文件进行时钟分析. 转载地址http://www.cnblogs.com/pejoicen/p/4194380.html PLL时钟约束 # Uncommenting one of the following derive_pll_cloc
tone()函数 tone(pin, frequency) tone(pin, frequency, duration) # 参数 pin: the pin on which to generate the tone frequency: the frequency of the tone in hertz - unsigned int duration: the duration of the tone in milliseconds (optional) - unsigned long to