在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1084|回复: 4

[求助] 有关DWA Matlab建模!

[复制链接]
发表于 2023-11-29 16:24:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
想请教各位前辈,如何将DWA或者IDWA模块加入到sigma-delta调制器之后进行仿真,里面具体参数如何变动啊?
IDWA模型示意图如下:
屏幕截图 2023-11-29 162031.png
里面模块参数如何设置:
屏幕截图 2023-11-29 162144.png
加入到调制器之后,运行后出现以下问题:
屏幕截图 2023-11-29 162336.png 屏幕截图 2023-11-29 162313.png
 楼主| 发表于 2023-11-29 18:39:40 | 显示全部楼层
顶一个啊
 楼主| 发表于 2023-11-29 20:00:00 | 显示全部楼层
有没有前辈懂得啊,感谢感谢
 楼主| 发表于 2023-11-30 14:08:04 | 显示全部楼层
有关matlab代码 存在好多问题 求各位前辈解释一下 谢谢 主要是对一些变量是什么?
%DNL error related
Estd=0.01;      % standard deviation of DNL errors
shape = 'sine'; k = 3;  %the DNL error shape
% shape:    k
% 'poly'    polynomial order




fsig = J/NT;

WLscale=0.5*(pow2(Bits)-1);  %
WLoffset = sum(0pow2(Bits)-1))/pow2(Bits);

K=0N-1);
simin=[t.' data'];

%estimating the DWA spurs using stimulus and DNL error shape:
[n_hat,ck,E] = dwa_spur_est(Bits,BPmode,Estd,shape,k,Bf,data,IDWAmode,1);
%n_hat is the estimate

if random_dir
    seqx = sign(randn(1,DL));
    seqx(seqx==0)=1;
else
    seqx=ones(1,DL);
end

if tf_mode
    seq = seqx;  % ...for plain DWA
else
                    % ...for BNF-dwa (see the ESL block)
    seq = [seqx -seqx];
end

if DACmode
    if IDWAmode
        sim IDWAMOD_DAC
    else
        sim DWAMOD_DAC
    end
else
    if IDWAmode
        sim IDWAMOD_ADC
    else
        sim DWAMOD_ADC
    end
end

%---- PLOT
if not(exist('win','var')) || (exist('win','var') && length(win)~=NT)
    %win=kaiser(NT,20);
    win=hann(NT);
end

if BPmode
    NS=pow2(log2(NT)-10);
else
    NS=pow2(log2(NT)-9);
end
wins = hann(NT/NS);

HdB=20*log10(abs(fft(win.*simout,NT)/(sum(win)*0.5)));
MdB=20*log10(abs(fft(win.*mmnoise,NT)/(sum(win)*0.5)));
MestdB=20*log10(abs(fft(win.*n_hat.',NT)/(sum(win)*0.5)));

Hid_dB=20*log10(abs(fft(win.*(simout+mmnoise),NT)/(sum(win)*0.5)));
fvek=linspace(fs/NT,fs/2,NT/2);

figure
subplot(321)
plot(fvek,HdB(1NT*0.5)),'b')
title('output signal'),axis tight
xlabel('frequency'),ylabel('dB')
hold on
YLim=get(gca,'YLim');
if BPmode
    plot((fs/4-fb/2)*[1 1],YLim,'k--',(fs/4+fb/2)*[1 1],YLim,'k--')
    text(fs/4+fb/2,YLim(2)-10,'\leftarrowsignal band')
else
    plot([fb fb],YLim,'k--')
    text(fb,YLim(2)-10,'\leftarrowsignal band')
end
hold off

subplot(325)
plotflag = 1;
%switch modelname
%    case {'DSDAC_none','DSADC_none'}
%        plot(fvek,MdB(1:(NT*0.5)),'r')
%        title('mismatch noise'),axis tight
%        xlabel('frequency'),ylabel('dB')
%        
%    otherwise
        plot(fvek,MestdB(1:(NT*0.5)),'c',fvek,MdB(1:(NT*0.5)),'r')
        title('mismatch spur estimate & true mismatch noise'),axis tight
        xlabel('frequency'),ylabel('dB')
%end
hold on        
if BPmode
    plot((fs/4-fb/2)*[1 1],YLim,'k--',(fs/4+fb/2)*[1 1],YLim,'k--')
    text(fs/4+fb/2,YLim(2)-10,'\leftarrowsignal band')
else
    plot([fb fb],YLim,'k--')
    text(fb,YLim(2)-10,'\leftarrowsignal band')
end
hold off
set(gca,'YLim',YLim)

subplot(323)
plot(fvek,Hid_dB(1:(NT*0.5)),'k')
title('ideal output'),axis tight
xlabel('frequency'),ylabel('dB')
hold on
%YLim=get(gca,'YLim');
if BPmode
    plot((fs/4-fb/2)*[1 1],YLim,'k--',(fs/4+fb/2)*[1 1],YLim,'k--')
    text(fs/4+fb/2,YLim(2)-10,'\leftarrowsignal band')
else
    plot([fb fb],YLim,'k--')
    text(fb,YLim(2)-10,'\leftarrowsignal band')
end
hold off
set(gca,'YLim',YLim)

%Subplots below use Modulo Time Plot, see File ID: #22907
t=linspace(0,Tfinal,NT).';

subplot(322)
tt=mod(t,1/fsig);
[tt,index]=sort(tt);
yy=simout(index);
n_poly = 5;
warning off %#ok<WNOFF>
p=polyfit(tt,yy,n_poly);
warning on %#ok<WNON>
yest=polyval(p,tt);
plot(tt,yy,'b.',tt,yest,'--k','MarkerSize',4)
title('modulo time plot, output signal')
axis tight,legend('data','mean',1),
xlabel(['time, 1 period is ', num2str(1/fsig,2),'s. t_s = ',...
    num2str(ts,2),'s'])

subplot(324)
qq = yy-yest;
plot(tt,qq,'m.','MarkerSize',4)
title('modulo time plot, qv. noise'), axis tight,xlabel('time, 1 period')
subplot(326)
plot(tt,mmnoise(index),'r.','MarkerSize',4)
axis tight, title('modulo time plot, mismatch noise')
xlabel('time, 1 period')

figure
subplot(211)
spectrogram(mmnoise,wins,length(wins)*0.5,[],1)
title('true mismatch noise spectrogram')
subplot(212)
spectrogram(n_hat,wins,length(wins)*0.5,[],1)
title('mismatch noise spurious noise estimate')

% 'rand'    random error, k is negligible, e.g. 0
% 'sine'    sinusoid DNL error shape with k periods

N=pow2(Bits)-1;  %number of elems 2^Bits-1
if IDWAmode
    N=N+1;
end

random_dir = 1;  % pointer direction can change as a random pattern, as
                 % long as the pattern length is D. See how the controlling
                 % sequence seq is created. If 1: random seq, else: ones.
%---- DWA SETUP END ----

if tf_mode==1
    Bf = [1,zeros(1,DL-1),-1];
else
    Bf = [1,zeros(1,DL-1),1];
end



%---- Stimulus
amp = 0.01;
fmult = 1/5;    % Input sinusoid's place in the signal band:
                 % left side to right side 0->1. 0.5 is in the middle.
fb=fs*0.5/32;      % signal band edge in lowpass mode

fsig = fmult*fb; % signal freq
J=fsig*NT/fs;

if abs(J-round(J))>0
    J=round(J);
    if rem(J,2)==0
        J=J+1;
    end
    J = round(J);
end

if BPmode
    J=J+NT/4;
end

fsig = J/NT*fs;

data = amp*cos(2*pi*fsig*t);
%---- Stimulus END
发表于 2023-12-5 19:16:49 | 显示全部楼层
我也遇到了你这样的问题,我是两阶两位,帮顶
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-12-22 19:02 , Processed in 0.020121 second(s), 9 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表