close all;clear;clc;
figure('position',[189 89 714 485]);
Na=['输入波形[请选择]|输入波形:正弦波|',...
];
Ns={'sin','square','pulse'};
R=2; % default parameters: resistance
C=2; % default parameters: capacitance
f=10; % default parameters: frequency
TAU=R*C;;
tff=10; % length of time
ts=1/f; % sampling length
sys1=tf([1],[1,1]); % systems for integral circuit
sys2=tf([1,0],[1,1]); % systems for differential circuit
a1=axes('position',[0.1,0.6,0.3,0.3]);
po1=uicontrol(gcf,'style','popupmenu',...
'unit','normalized','position',[0.15,0.9,0.2,0.08],...
'string',Na,'fontsize',12,'callback',[]);
set(po1,'callback',['KK=get(po1,''Value'');if KK>1;',...
'st=char(Ns(KK-1));[U,T]=gensig(st,R*C,tff,1/f);',...
'axes(a1);plot(T,U);ylim([min(U)-0.5,max(U)+0.5]);',...
'end;']);
Ma=['电路类型[请选择]|电路类型:积分型'];
a2=axes('position',[0.5,0.6,0.3,0.3]);box on;
set(gca,'xtick',[]);set(gca,'ytick',[]);
po2=uicontrol(gcf,'style','popupmenu',...
'unit','normalized','position',[0.55,0.9,0.2,0.08],...
'string',Ma,'fontsize',12,'callback',[]);
set(po2,'callback',['KQ=get(po2,''Value'');axes(a2);',...
'if KQ==1;cla;elseif KQ==2;',...
'plot(0.14+0.8i+0.02*exp(i*[0:.02:8]),''k'');hold on;',...
'plot(0.14+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot(0.84+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot(0.84+0.8i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot([0.16,0.82],[0.2,0.2],''k'');',...
'plot([0.16,0.3],[0.8,0.8],''k'');',...
'plot([3,4,4,3,3]/10,[76,76,84,84,76]/100,''k'');',...
'plot([0.4,0.82],[0.8,0.8],''k'');',...
'plot([0.6,0.6],[0.8,0.53],''k'');',...
'plot([0.6,0.6],[0.2,0.48],''k'');',...
'plot([0.55,0.65],[0.53,0.53],''k'');',...
'plot([0.55,0.65],[0.48,0.48],''k'');',...
'text(0.33,0.7,''R'');',...
'text(0.63,0.42,''C'');',...
'text(0.8,0.5,''U_o'');text(0.1,0.5,''U_i'');hold off;',...
'set(gca,''xtick'',[]);set(gca,''ytick'',[]);',...
'else;',...
'plot(0.14+0.8i+0.02*exp(i*[0:.02:8]),''k'');hold on;',...
'plot(0.14+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot(0.84+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot(0.84+0.8i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot([0.16,0.82],[0.2,0.2],''k'');',...
'plot([0.16,0.33],[0.8,0.8],''k'');',...
'plot([0.33,0.33],[0.74,0.86],''k'');',...
'plot([0.36,0.36],[0.74,0.86],''k'');',...
'plot([0.36,0.82],[0.8,0.8],''k'');',...
'plot([0.6,0.6],[0.8,0.58],''k'');',...
'plot([0.6,0.6],[0.2,0.42],''k'');',...
'plot([58,62,62,58,58]/100,[42,42,58,58,42]/100,''k'');',...
'text(0.33,0.68,''C'');',...
'text(0.63,0.42,''R'');',...
'text(0.8,0.5,''U_o'');text(0.1,0.5,''U_i'');hold off;',...
'set(gca,''xtick'',[]);set(gca,''ytick'',[]);',...
'end;axis([0,1,0,1]);']);
a3=axes('position',[0.1,0.1,0.3,0.3]);
pu3=uicontrol(gcf,'style','push',...
figure('position',[189 89 714 485]);
Na=['输入波形[请选择]|输入波形:正弦波|',...
];
Ns={'sin','square','pulse'};
R=2; % default parameters: resistance
C=2; % default parameters: capacitance
f=10; % default parameters: frequency
TAU=R*C;;
tff=10; % length of time
ts=1/f; % sampling length
sys1=tf([1],[1,1]); % systems for integral circuit
sys2=tf([1,0],[1,1]); % systems for differential circuit
a1=axes('position',[0.1,0.6,0.3,0.3]);
po1=uicontrol(gcf,'style','popupmenu',...
'unit','normalized','position',[0.15,0.9,0.2,0.08],...
'string',Na,'fontsize',12,'callback',[]);
set(po1,'callback',['KK=get(po1,''Value'');if KK>1;',...
'st=char(Ns(KK-1));[U,T]=gensig(st,R*C,tff,1/f);',...
'axes(a1);plot(T,U);ylim([min(U)-0.5,max(U)+0.5]);',...
'end;']);
Ma=['电路类型[请选择]|电路类型:积分型'];
a2=axes('position',[0.5,0.6,0.3,0.3]);box on;
set(gca,'xtick',[]);set(gca,'ytick',[]);
po2=uicontrol(gcf,'style','popupmenu',...
'unit','normalized','position',[0.55,0.9,0.2,0.08],...
'string',Ma,'fontsize',12,'callback',[]);
set(po2,'callback',['KQ=get(po2,''Value'');axes(a2);',...
'if KQ==1;cla;elseif KQ==2;',...
'plot(0.14+0.8i+0.02*exp(i*[0:.02:8]),''k'');hold on;',...
'plot(0.14+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot(0.84+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot(0.84+0.8i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot([0.16,0.82],[0.2,0.2],''k'');',...
'plot([0.16,0.3],[0.8,0.8],''k'');',...
'plot([3,4,4,3,3]/10,[76,76,84,84,76]/100,''k'');',...
'plot([0.4,0.82],[0.8,0.8],''k'');',...
'plot([0.6,0.6],[0.8,0.53],''k'');',...
'plot([0.6,0.6],[0.2,0.48],''k'');',...
'plot([0.55,0.65],[0.53,0.53],''k'');',...
'plot([0.55,0.65],[0.48,0.48],''k'');',...
'text(0.33,0.7,''R'');',...
'text(0.63,0.42,''C'');',...
'text(0.8,0.5,''U_o'');text(0.1,0.5,''U_i'');hold off;',...
'set(gca,''xtick'',[]);set(gca,''ytick'',[]);',...
'else;',...
'plot(0.14+0.8i+0.02*exp(i*[0:.02:8]),''k'');hold on;',...
'plot(0.14+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot(0.84+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot(0.84+0.8i+0.02*exp(i*[0:.02:8]),''k'');',...
'plot([0.16,0.82],[0.2,0.2],''k'');',...
'plot([0.16,0.33],[0.8,0.8],''k'');',...
'plot([0.33,0.33],[0.74,0.86],''k'');',...
'plot([0.36,0.36],[0.74,0.86],''k'');',...
'plot([0.36,0.82],[0.8,0.8],''k'');',...
'plot([0.6,0.6],[0.8,0.58],''k'');',...
'plot([0.6,0.6],[0.2,0.42],''k'');',...
'plot([58,62,62,58,58]/100,[42,42,58,58,42]/100,''k'');',...
'text(0.33,0.68,''C'');',...
'text(0.63,0.42,''R'');',...
'text(0.8,0.5,''U_o'');text(0.1,0.5,''U_i'');hold off;',...
'set(gca,''xtick'',[]);set(gca,''ytick'',[]);',...
'end;axis([0,1,0,1]);']);
a3=axes('position',[0.1,0.1,0.3,0.3]);
pu3=uicontrol(gcf,'style','push',...