clc clear all close all R1=6340 R2=80.6; R3=127000; C1=0.1e-6; C2=C1; BF=400; LF=600; DF=1; Tr1=0.02; Tc1=0.15; Tr2=0.01; Tc2=0.1; T=[-Tr1 -Tr1 -Tr1 -Tc1 -Tc1;Tr2 Tr2 Tr2 Tc2 Tc2]; N=10; M=5; Lit=(LF-BF)/DF+1; randn('state',sum(100*clock)); NN1=zeros(Lit,1); DD1=zeros(N,1); DD0=zeros(N,1) Vo=zeros(Lit,1); Vm=zeros(N,Lit); Tn=zeros(N,M); F=linspace(BF,LF,Lit); for mc=1:2; for k=1:N for w=1:M if mc==1 Tn(k,w)=((T(2,w)-T(1,w))/6)*(randn+3)+T(1,w)+1; else Tn(k,w)=(T(2,w)-T(1,w))*randn+T(1,w)+1; end end end for i=1:Lit s=0+2*pi*F(i)*j; Vo(i)=B2(R1,R2,R3,C1,C2,s); for k=1:N Vm(k,i)=B2(R1*Tn(k,1),R2*Tn(k,2),R3*Tn(k,3),C1*Tn(k,4),C2*Tn(k,5),s); end end % get stastics if mc==1 Vmax1=max(Vm);Vmin1=min(Vm); else Vmax2=max(Vm);Vmin2=min(Vm); end end subplot(2,1,1) h=plot(F,Vmax1,'k',F,Vmin1,'k',F,Vo,'k'); set(h,'LineWidth',2); grid on axis([BF LF 0 15 ]); ylabel('Volts'); title('Fig 1. BPF MCA,normal dist') text(420,12,['N= ',num2str(N)]); subplot(2,1,2) h=plot(F,Vmax2,'k',F,Vmin2,'k',F,Vo,'k'); set(h,'LineWidth',1); grid on axis ([BF LF 0 15]);