⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsdemo3.m

📁 这是一个新的用于图像处理的工具箱
💻 M
字号:
% Realization and dynamic range scalingclcif exist('LiveDemo','var') == 0    LiveDemo=0;end fprintf(1,'\t\t\t Modulator realization and scaling\n\n');echo on;order=5; R=42; opt=1;H = synthesizeNTF(order,R,opt);[a,g,b,c] = realizeNTF(H);b = [b(1) zeros(1,length(b)-1)];	% Use a single feed-in for the inputecho offfigure(1); clf;plotPZ(H)%title('Poles and zeros of a 5th-order modulator')if LiveDemo    set(1,'position',[10 307 480 420]);    changeFig(18,2,12);	pause    set(1,'position',[9 526 200 200]);    changeFig;else	drawnow;	endfprintf(1,'\nUnscaled modulator\n');fprintf(1,'   DAC feedback coefficients = ');for i=1:order    fprintf(1,' %.6f',a(i));endfprintf(1,'\n   resonator feedback coefficients = ');for i=1:order/2    fprintf(1,' %.6f',g(i));endfprintf(1,'\n');fprintf(1,'\nCalculate the state maxima.\n');ABCD = stuffABCD(a,g,b,c);echo on;u = linspace(0,0.6,30);N = 1e4; echo off;T = ones(1,N);maxima = zeros(order,length(u));for i = 1:length(u)    ui = u(i);    [v,xn,xmax] = simulateDSM( ui(T), ABCD );    maxima(:,i) = xmax(:);    if any(xmax>1e2) 	umax = ui;	u = u(1:i);	maxima = maxima(:,1:i);    	break;    endendfigure(2); clffor i = 1:order    semilogy(u,maxima(i,:),'o');    if i==1	hold on;    end    semilogy(u,maxima(i,:),'--');endgrid on;xlabel('DC input')set(gcf,'NumberTitle','off'); set(gcf,'Name','Simulated State Maxima');axis([ 0 0.6 1e-4 10]);if LiveDemo    set(2,'position',[238 355 511 372]);    changeFig(18,2,8);	pauseelse	fprintf(1,'paused\n');	pause;endclcfprintf(1,'\nCalculate the scaled coefficients.\n');echo on;[ABCDs,umax] = scaleABCD(ABCD,[],[],[],[],[],1e4);[as,gs,bs,cs] = mapABCD(ABCDs);echo off;fprintf(1,'\nScaled modulator, umax=%.2f\n', umax);fprintf(1,'   DAC feedback coefficients = ');for i=1:order    fprintf(1,' %.6f',as(i));endfprintf(1,'\n   resonator feedback coefficients = ');for i=1:order/2    fprintf(1,' %.6f',gs(i));endfprintf(1,'\n   interstage coefficients = ');for i=1:order    fprintf(1,' %.6f',cs(i));endfprintf(1,'\n   feed-in coefficients = ');for i=1:order    fprintf(1,' %.6f',bs(i));endfprintf(1,'\n');fprintf(1,'\nCalculate the state maxima.\n');echo on;u = linspace(0,umax,30);N = 1e4; echo off;T = ones(1,N);maxima = zeros(order,length(u));for i = 1:length(u)    ui = u(i);    [v,xn,xmax] = simulateDSM( ui(T), ABCDs );    maxima(:,i) = xmax(:);    if any(xmax>1e2) 	umax = ui;	u = u(1:i);	maxima = maxima(:,1:i);    	break;    endendfigure(2); clffor i = 1:order    semilogy(u,maxima(i,:),'o');    if i==1    	hold on;    end    semilogy(u,maxima(i,:),'--');endgrid on;xlabel('DC input')axis([ 0 0.6 4e-2 4]);if LiveDemo    set(2,'position',[238 355 511 372]);    changeFig(18,2,8);	pause    set(2,'position',[238 527 494 200]);    changeFig;end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -