Professional Documents
Culture Documents
ANALYSIS
OF ELECTRONIC
CIRCUITS
"USI:NG
IVIATLAB®
Robert R. Boyd
0 CRC Press
Taylor & Francis Group
Boca Raton London New York
iii
About the Author
Robert R. Boyd was a technical instructor in the United States
Air Force for 19 years. Upon his retirement from the Air Force in
1971, he enrolled at the University of New Mexico and obtained a
BSEE degree with honors in 1974. Mr. Boyd was employed in the
aerospace industry in anlog circuit design until 1996. He is presently
a consultant in analog circuit design and analysis and teaches a course
in the tolerance analysis of electronic circuits at the University of
California Extension (Irvine, CA).
v
Contents
PART I
Root-Sum-Square and Extreme Valuue Analysis
Derivatives and Sensitivities.....•......•.••...................••.••....•.••••...•••••..• I
Approximate Derivatives and Sensitivities ...................................... 2
Tolerance Analysis of a DC Differential Amplifier •••••••••.••••••••.•••..• 3
MATLAB M-file diffamp.m ........................................................... ll
Nominal Output = Zero.................................................................. 14
Combined Gain and Offset Analysis..••..••••..••••..•••.••••.••••..••••••••••••• 17
More Complicated Circuits ............................................................ 19
Tolerance Analysis of AC Circuits ................................................. 26
Tolerance Analysis of Bandpass Filter........................................... 29
Bandpass Filter with Asymmetric Tolerances •.•.............••.•••.....•.•.. 39
Lowpass Filter ................................................................................41
Spice Results Compared•••••••••••••••••••••••.••.•••••••••••••••••••••••••••••••••••••• 4S
Tolerance Analysis of Stability ••••.•.••.•..••..••••••••.•••.•••••.•••.••.•.••..•.•.•46
PART2
Monte Carlo Analysis
General Comments Concening RSS .............................................. 65
Uniform vs. Gaussian Distribution..•..••............•.•.....•.•••.••.•.•..•.....•• 66
Ratiometric Tolerances ····-······················································-· ·66
MCA of Opamp de Offsets ............................................................ 70
MCA of RTD Circuit ....•...•••••...••••••••.•.•.•.•.••...•.••.•..•••••••.•••••••...••••. 75
MCA of Bandpass Filter (BPF) Circuit •••.•.••••••.•.••••••••.••••••••••.•••••• 78
Fast Monte Carlo Analysis ......•...•.•.•..•..•.•...••..••••••••..•.•.•.•...••••.••.... 85
Sallen and Key BPF ....................................................................... 92
vii
viii Tolerance Analysis of Electronic Circuits
APPENDIX
Derivation of the RSS Equation ................................................... 113
BPF Sensitivity Expressions......................................................... 115
Confidence Intervals ..................................................................... 119
Percent Yield ................................................................................. l20
Mathematical Curios..................................................................... l22
An "Accurate" Cancer Test ...................................................... 122
Easter Dates .............................................................................. 123
Number of Weekdays Between Two Datcs.............................. l24
M-file Listings .............................................................................. 125
REFERENCES............................................................................ 147
Introduction
There are three well-known tolerance analysis methods. The first two
are covered in Part 1:
1. Root-Sum-Square analysis (RSS)
2. Extreme Value Analysis (EVA) (sometimes called worst-case
analysis)
The third is covered in Part 2:
3. Monte Carlo Analysis (MCA)
The author has added a fourth method that is an application of an
old idea:
4. Fast Monte Carlo Analysis (FMCA).
As will be shown, this method exposes several weaknesses in methods
I and 2 above.
The treatment of asymmetric tolerances is neglected in what few
existing publications there are on the subject. (See References.)
Asymmetric tolerances can occur when performing design verifica-
tion analyses where the specification temperature extremes, and
hence the temperature variation of the components are most always
asymmetric. For example: -55°C to +85°C. The worst-case methods
used in circuit analysis packages derived from Spice cannot acco-
modate asymmetric tolerances. In addition, for ac circuits the sensi-
tivity portion and the resulting output of the present-day
Spice .WCASE analyses is incorrect as will be shown.
In ac analyses, especially in high-Q, high-gain filter circuits,
there are some pitfalls that the analyst must be aware of. These
anomalies will be illustrated by several examples.
ix
X Tolerance Analysis of Electronic Circuits
SY =~ dy
• y dx
1
2 Tolerance Analysis of Electronic Circuits
S t 2R2
='iJVo (3000)
- - = - - ·6.25·10 =0.25 _.
Vo 'iJR2 7.5
The units here are%/%, since (nN) times (V/n) = 1, i.e., dimen-
sionless. Hence if R2 increases by +1%, the output voltage will
increase by 0.25% or 7.5 ( 1.0025) = 7 .519V. Note that the normalized
sensitivity is independent of the component tolerance.
l!t.y = f(x+l!t.x}-f(x)
l!t.x l!t.x
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 3
Note that the component values cancel. However, this does not mean
the sensitivity is independent of the component value. It can be
shown that the sensitivity for R2 is:
Vo Rl
Sen2=1--=---
El Rl+R2
TOLERANCE ANALYSIS OF A DC
DIFFERENTIAL AMPLIFIER
E1
The general procedure for RSS and EVA tolerance analysis of this
simple de circuit is as follows:
4 Tolerance Analysis of Electronic Circuits
Vo = G(Rl,R2,R3,R4,El,E2); Vo = 20V
1.0001
1 1.0001
1 1 1.0001
Q=
1 1 1.0001
1 1.0001 1
1 1 1.0001
Note that the 1st and 3rd elements are less than the nominal value
of Vo = 20, and that the relt'aining elements are greater than Vo. In
other words, R 1 and R3 have a negative sensitivity sign, while the
remaining components have a positive sensitivity sign.
Vr ) 1
Sen, = ( V~ - 1 · dpf
6 Tolerance Analysis of Electronic Circuits
which gives:
Note that the column order is Rl, R2, R3, R4, El, E2 and that the
tolerances are symmetric.
for p=l:N
i f Sen(p)>O
M(l,p)=l+T(l,p);M(2,p)=l+T(2,p);
else
M(l,p)=l+T(2,p);M(2,p)=l+T(l,p);
end
end
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 7
If the sensitivity is < 0, this block of code will replace the negative
tolerance with the corresponding positive tolerance plus 1. The result
is stored in array M. If the sensitivity is > 0, it merely copies the
tolerance + I into M. The result is:
Step 10: Now create a low-high row counter k = 1,..2, and plug the
M elements into the circuit function as follows:
Step 11: Before computing the RSS values, some definitions are in
order.
QIU = R(T
3
1
(
AYo·R1
3·AR
·1j) 2 2
=(AVo ·T1 ) =(AYo ·T1)
3·A 3·dpf
2
Using AVrs as the variable name for~ (the three sigma value of
the output), the expression for AVrs is:
AVo, AVo,
Sen = , Sen = , etc.
' Yo · dpf • Yo · dpf
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 9
~Yrst =(-1)k·Yo·~(
' Sen,-Tt.p)2 (1~ ~Yrs= [-{).757]
.
0 757
~Yrs and ~Yrss are then added to Yo to get the -3o and +30 values
of 19.243 and 20.757.
The (-l)k is added as a convenience so that both elements can be
added to Yo.
To show where form (2) is used, we change the tolerance array
T to asymmetric tolerances Ta:
for p=l:N
i f Sen(p)>O
Ma(l,p)=l+Ta(l,p);Ma(2,p)=l+Ta(2,p);
else
Ma(l,p)=l+Ta(2,p);Ma(2,p)=l+Ta(l,p);
end
end
10 Tolerance Analysis of Electronic Circuits
since Sen(l) and Sen(3) are< 0. J!Vrs and J!Vrss now become:
18.262] [-1.738]
Veva= [ 1. J!Veva=Veva-Vo= 1.
2 424 424
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 11
I 1 E1
-+-
Rl R2
0 0
R2
-R1
I -I 0 0 0
A= B=
1 1 E2
0 0 -+- -
R3 R4 R3
0 Ao -Ao 0
12 Tolerance Analysis of Electronic Circuits
for p=1:N
A=(1/(R1*Q(p,1))+1/(R2*Q(p,2)) 0 0
-1/(R2*Q(p,2));1 -1 0 0; 0 0 .•.
1/(R3*Q(p,3))+1/(R4*Q(p,4)) 0; .•.
0 Ao -Ao 1);
B=[E1*Q(p,5)/(R1*Q(p,1));0; ...
E2*Q(p,6)/(R3*Q(p,3));0);
C=A\B;Vr=C(4);
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 13
'II
'II Step 7 Calculate normalized sensitivities
'II
Sen(pl=CVr/Vo-1)/dpf;
end
'II
'II Step 8 Create tolerance array T
'II
Tr=0.01;Te=O.OS;
T=[-Tr -Tr -Tr -Tr -Te-Te; ...
Tr Tr Tr Tr Te Tel;
for p=1:N
i f Sen(p)>O
M(1,p)=1+T(1,p);
M(2,p)=1+T(2,p);
else
M(1,p)=1+T(2,p);
M(2,p)=1+T(1,p);
end
end
'II
'II Step 10 Calculate EVA values
'for k::1:2
A=[1/(R1*M(k,1))+1/(R2*M(k,2)) 0 0 ...
-1/(R2*M(k,2));1 -1 0 0; ...
0 0 1/(R3*M(k,3))+1/(R4*M(k,4)) 0; .•.
0 Ao -Ao 1]; B=[E1*M(k,5)/(R1*M(k,1));0; ...
E2*M(k,6)/(R3*M(k,3));0];
C=A\B;Vev(k)=C(4);
end
'II
' Step 11 Calculate RSS values
'II
swn1=0;swn2=0;
for p=1:N
swn1=swn1 + (Sen(p)*(M(1,p)-1))A2;
swn2=swn2 + (Sen(p)*(M(2,p)-1))A2;
end
14 Tolerance Analysis of Electronic Circuits
Vrss(1)=Vo*(1- sqrt(sum1));
Vrss(2)=Vo*(l + sqrt(sum2));
Von=[Vo Vo);V1=[Vrss;Von;Vev);
'
% Send output to text file 'Output.txt'
'
fid=fopen('Output.txt', 'w');
fprintf(fid, 'Differential Amplifier\r\n');
fprintf(fid,'RSS NOM EVA\r\n');
fprintf(fid,'%3.3£ %3.3£ %3.3f\r\n',V1);
status=fclose(fid);
Differential Amplifier
RSS NOM EVA
19.243 20.000 18.624
20.757 20.000 21.424
t File diffamp2.m
t de differential amplifier with Vo = 0
t function DA2.m used to decrease required code
clear;clc
'
Rl=l0;R2=100;R3=10;R4=100;El=l;E2=l ; Ao=le6;
'
Vo=DA2(Rl,R2,R3,R4,El,E2,Ao);
'
Nc=6;dpf=O.OOOl;Q=dpf*eye(Nc)+l;
'forVr(p)=DA2(Rl*Q(p,l),R2*Q(p,2),
p=l:Nc
. ..
R3*Q(p,3),R4*Q(p,4), ...
El*Q(p,5),E2*Q(p,6),Ao);
end
t Sensitivities cannot be calcuated; Vo=O
'
Tr=O.Ol;Te=O;
T=[ -Tr -Tr -Tr -Tr -Te-Te; ...
Tr Tr Tr Tr Te Tel;
for p=l:Nc
i f Vr(p)>O
M(l,p)=l+T(l,p);M(2,p)=l+T(2,p);
else
M(l,p)=l+T(2,p);M(2,p)=l+T(l,p);
end
end
%
for k=l:2
Vev(k)=DA2(Rl*M(k,l),R2*M(k,2), ...
R3*M(k,3),R4*M(k,4), . . .
El*M(k,5),E2*M(k,6),Ao);
end
'suml=O;sum2=0;
for p=l:Nc
suml=suml + (Vr(p)*(M(l,p)-l))A2;
sum2=sum2 + (Vr(p)*(M(2,p)-l))A2;
end
Vrss(l)=-sqrt(suml)/dpf;
16 Tolerance Analysis of Electronic Circuits
Vrss(2)=sqrt(sum2)/dpf;
Von=[Vo Vo);V1=[Vrss;Von;Vev);
'fid=fopen('OUtput.txt', 'w');
fprintf(fid, 'Diff Amp, Vo = 0\r\n');
fprintf(fid, 'RSS NOM EVA\r\n');
fprintf(fid,'%3.2e %3.2e %3.2e\r\n',V1);
status=fclose(fid);
s1='Diff Amp Vo = 0\';
s2='r RSS NOM EVA';
s3=strcat(s1,s2);
Title=sprintf(s3)
0Utput=sprintf('%3.2e %3.2e %3.2e\n',V1)
function y = DA2(R1,R2,R3,R4,E1,E2,Ao);
% function for de diffamp
A=[1/R1 + 1/R2 0 0 -1/R2;1 -1 0 0; ...
0 0 1/R3 + 1/R4 0; .•.
0 Ao -Ao 1);
B=[El/R1;0;E2/R3;0);
C=A\B;y=C(4);
Diff Amp, Vo = 0
RSS NOM EVA
-1. 82e-003 O.OOe+OOO -3.64e-003
1.82e-003 O.OOe+OOO 3.63e-003
Diff Amp, Vo = 0
RSS NOM EVA
-1.82e-002 O.OOe+OOO -3.70e-002
1.82e-002 O.OOe+OOO 3.57e-002
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 17
The input voltage is 15V. The offset is 4mV and the nominal
circuit output is 4.396V.
For Step 11, when Vos is non-zero, and comparing with the RSS
term:
\File diffamp3.m
\ Combined gain and offset analysis
\ function not used
clear;clc
\ Step 1
R1=75000;R2=1000;R3=20000 ; R4=898;E1=15;Vos=0.004;
\ Step 2 & 3
Vo=(E1*R2/(R1+R2)+0)*R3/R4;
'15 Step 4 & 5
Nc=6;dpf=0.0001;Q=dpf*eye(Nc)+l;
\ Step 6
for p=1:Nc
Vr(p)=(El*Q(p,l)*R2*Q(p,3)/ ...
(R1*Q (p, 2) +R2*Q (p, 3)) +Vos* ( (Q (p, 6) -1) /dpf)) ...
*R3*Q(p,4)/(R4*Q(p,S));
end
18 Tolerance Analysis of Electronic Circuits
c'No=Vr(Nc)-Vo;
% Step 7
for q=1:Nc-1;Sen(q)=((Vr(q}/Vo)-1)/dpf;end
% step 8
Tr=0.01;
T=[-Tr -Tr -Tr -Tr -Tr -vos;Tr Tr Tr Tr Tr Vos];
% Step 9
for q=1:Nc-1
i f Sen(q)>O
M(1,q)=1+T(1,q);M(2,q)=1+T(2,q);
else
M(1,q)=1+T(2,q);M(2,q)=1+T(1,q);
end
end
% step 10
for k=1:2
Vev(k)=(E1*M(k,1}*R2*M(k,3}/ ••.
(R1*M(k,2)+R2*M(k,3))+T(k,Nc)) ...
*R3*M(k,4}/(R4*M(k,5));
end
% Step 11
sum1=0;sum2=0;
for q=1:Nc-1
sum1=sum1 + (Sen(q)*(M(1,q)-1))A2;
sum2=sum2 + (Sen(q}*(M(2,q)-1))A2;
end
sum1=sum1+(c'No/Vo)A2;sum2=sum2+(c'No/Vo)A2;
Vrss(1)=Vo*(1-sqrt(sum1));
Vrss(2)=Vo*(1+sqrt(sum2));
Von=[Vo Vo];V1=[Vrss; Von; Vev];
% output to text file and command window
fid=fopen ('Output. txt', 'w');
fprintf(fid,'Combined gain & offset\r\n');
fprintf(fid,'RSS NOM EVA\r\n};
fprintf(fid,'%3.3f %3.3f %3 .3f\r\n' ,Vl);
status=fclose(fid);
s1='Combined gain & offset';
s2='\rRSS NOM EVA';
s3=strcat(sl,s2);
Title=sprintf(s3)
Output=sprintf('%3.3£ %3.3f %3.3f\n',Vl)
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 19
RJ
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 21
Al=R3{(Rl+R4)(RS+R6)]-R2[R7(Rl+R4)+R3(RS+R6+2R7)]
A2 = R2{(Rl+R4)(RS+R6+R7))
2 2
Nl=RT·Al Dl=RT·A2 Vo= E (Nl+N ) Vo=4.326V(242°C)
01+02
Since the circuit has five nodes, a 5th order matrix is required. By
inspection of the circuit diagram above, the creation of the first four
rows, corresponding to nodes VI through V4, is a simple book-
keeping task. We start with node V 1 and main diagonal element
A(l,l) in the upper left-hand comer and proceed down to the lower
right comer:
and so forth. For the off-diagonal elements, we see from the diagram
that RT is connected between nodes VI and V2, R4 is connected
between nodes VI and V3. Hence the A coefficient matrix will be
as follows:
22 Tolerance Analysis of Electronic Circuits
1 1
-+-+-
1
Rl R4 RT
-RT
-1 -1
R4
0 0
-1 1 1 1 -1
-+-+- 0 0
Rt RT R5 R6 RS
A= -1 1 1 1 -1
- 0 -+-+- 0
R4 R2 R3 R4 R3
-1 1 1
0 0 -+- 0
RS RS R7
0 0 Ao -Ao
B=[E2 !!_E.!_ 0
Rl R6 R2
o]T
Cramer's Rule can be used to solve for V5 only. Hence the B 1 matrix
below is created by replacing the last column of the A matrix with
the B vector.
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 23
1 1 1 -1 -1 E2
-+-+- 0
Rl R4 RT RT R4 Rl
-1 1 1 1 -1 El
-+-+- 0
RT RT R5 R6 R5 R6
81= -1 1 1 1 El
0 -+-+- 0
R4 R2 R3 R4 R2
-1 1 1
0 0 -+- 0
R5 R5 R7
0 0 Ao -Ao 0
Step 10: Get the EVA output Vev by using the circuit function or
matrices multiplied by elements of array M.
The following MA11..AB file analyzes the RTD circuit. Note that
once the initial A matrix and 8 vector is formed, the formation of
the subsequent matrices can be facilitated by using MATI..AB func-
tions, which are much like subroutines and hence save rewriting the
large matrices. The following M-file uses a function named G2.m.
% Step 7
Sen(p)=((VS(p)/Vo)-1)/der;
end
% Step 8
Tinit=0.001;Tlife=0.002;ppm=1e-6;TC1=50*ppm;
TC2=25*ppm;
Thi=Tinit+Tlife+3S*TC1;T1o=-Tinit-Tlife-80*TC1;
Trhi=8.1e-4;Trlo=-Trhi;Treflo=-0.02-80*TC2;
Trefhi=0 . 02+3S*TC2;
T=[ Tlo Tlo Tlo Tlo Tlo Tlo Tlo Trlo Treflo; ...
Thi Thi Thi Thi Thi Thi Thi Trhi Trefhi);
% Step 9
for p=l:N
if Sen(p)>O
M(l,p)=l+T(l,p);M(2,p)=l+T(2,p);
else
M(l,p)=1+T(2,p);M(2,p)=l+T(l,p);
end
end
% Step 10
for k=1:2
Vev(k)=G2(Rl*M(k,l),R2*M(k,2),R3*M(k,3), ...
R4*M(k,4),RS*M(k,S),R6*M(k,6), ...
R7*M(k,7),RT*M(k,8),El*M(k,9),E2*M(k,9),Ao);
end
% Step 11
suml=O;sum2=0;
for p=l:N
suml=suml + (Sen(p)*(M(l,p)-l))A2;
sum2=sum2 + (Sen(p)*(M(2,p)-1))A2;
end
Vrss(1)=Vo*(l-sqrt(suml));
Vrss(2)=Vo*(l+sqrt(sum2));
Von=[Vo Vo);Vl=[Vrss;Von; Vev);
% output to text file and command window.
fid=fopen('Output.txt', 'w');
fprintf(fid, 'RTD Circuit\r\n');
fprintf(fid, 'RSS NOM EVA\r\n');
fprintf(fid, '%3.3£ %3.3£ %3.3f\r\n',Vl);
st~tus=fclose(fid);
Title=sprintf('RTD Circuit\rRSS NOM EVA')
Output=sprintf( ' %3 . 3£ %3 . 3£ ,3.3£\n',Vl)
26 Tolerance Analysis of Electronic Circuits
function y = G2(Rl,R2,R3,R4,RS,R6,R7,RT,El,E2,Ao)
' mea for rtd function
A=zeros(5);
A(l,l)=l/Rl+l/R4+1/RT;A(l,2)=-l/RT;A(l,3)=-l/R4;
A(2,l)=A(l,2);A(2,2)=1/RS+l/R6+1/RT;A(2,4)=-l/RS;
A(3,l)=A(l,3);A(3,3)=1/R2+1/R3+1/R4;A(3,5)=-l/R3;
A(4,2)=A(2,4);A(4,4l=l/RS+l/R7;
A(5,3)=Ao;A(S,4l=-Ao;A(5,5)=1;
B=(E2/Rl;El/R6;El/R2;0;0];C=A\B;y=C(5);
RTD Circuit
RSS NOM EVA
4.139 4.326 3.869
4.527 4.326 4.841
'
A=[({s*Cl)/(s*Rl*Cl+l)+l/R2) -l/R2;Aol 1];
B=[s*Cl/(s*Rl*Cl+l);O];
Va=A\B;Vo(i)=20*log10(abs(Va(2)));
% output in dBV
end
'% plot results
'
h=plot(FM,Vo,'k',FM,Op, 'k');
set(h,'LineWidth ' ,2)
grid on
axis([BF BF+ND -20 80))
xlabel('Log Freq (Hz) ');ylabel('dBV')
title('Fig.l BW Limited Diff Amp')
% Option - print to graphics file
\print -dlneta bwlim
\print -dhpgl bwlim
\print -dbitmap bwlim
28 Tolerance Analysis of Electronic Circuits
C1 R1 Vn R1
E~~~~~~~~--~
Vo
The results are plotted in Figure 1 which shows the opamp open loop
gain and the closed loop opamp output. The bandwidth limiting effect
of the opamp rolloff can clearly be seen.
1:~7 ~-
-10
-20L;-----~----......l-;-------'-;-----.Ji
1~ 1~ 1~
FAOQ fliz,l
1f
""\" 1~
Increment counter:
· =l .. •(LF-BF)
I DF +l
30 Tolerance Analysis of Electronic Circuits
Frequency in Hz:
F1 =BF+DF(i-1}
Laplace transform:
El-Vl VI
- - = - + ( V I - V3}·s C2+ Vl ·s Cl
Rl R2 I I
l 1
V ( -+-+sCl+sC2) -V3 ·sC2=-
ffi
Rl R2 I I I Rl
The nominal output Yo will be shown along with the RSS and EVA
plots.
Step 5: Q = dpf.identity(N) + 1
·+·~~]
C =A\8, Yr~.p =C(2);
Sen
t.p
=( ~-1-
Yr
1
Yo
1
dpf
)
T= [
-Tr -Tr -Tr -Tc -Tc]
Tr Tr Tr Tc Tc
32 Tolerance Analysis of Electronic Circuits
·+:L,l
Step lOb: To get EVA high, we replace the L's in the above matrices
with H's. See the following M-file.
if k==l
VL(i) =D;
else
VH(il=D;
end
end
'\ get rss
' suml(i)=O;sum2(il=O;
for p=l:Nc
suml(il=suml(i)+(Sen(i,p)*(L(i,p)-l))A2;
sum2(il=sum2(i)+(Sen(i,p)*(H(i,p)-l))A2;
end
Vrssl(il=Vo(i)*(l-sqrt(suml(i)));
Vrss2(i)=Vo(il*(l+aqrt(sum2(illl;
end
'
aubplot(2,2,1)
h=plot ( F, Sen ( : , 1 l , 'k' , F, Sen ( : , 2 l , 'm' , ...
F, Sen ( : , 3 l , ' c ' l ;
hold on
g=plot(F,Sen(:, 4), 'r', F, Sen(:, 5), 'g' l;
set(h, 'LineWidth',ll;set(g, 'LineWidth',l)
grid on
axis([BF LF -15 15))
xlabel('Freq (Hz)', 'Fontsize',Sl
ylabel('\/\', 'FontSize',8)
title('Fig 6. Sensitivities', 'FontSize',8)
hold off
'
subplot(2,2,2)
h=plot ( F, Sen ( : , 1 l , 'k' , F, Sen ( : , 2 l , 'k' , .•.
F, Sen ( : , 3 ) , ' k ' ) ;
hold on
g=plot (F, Sen (:, 4 l , 'r' , F, Sen (:, 5 l , 'g' ) ;
set(h, 'LineWidth',l);set(g, 'LineWidth',ll
grid on
axis([500 501 -2 2));
YT=linspace(-2,2,5);set(gca,•ytick',YT)
xlabel('Freq (Hz)','FontSize',8);
ylabel('\/\','FontSize',8)
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 35
function y = G1(R1,R2,R3,C1,C2,s)
% bpf function with matrices
A=[1/R1+1/R2+s*Cl+s*C2 -s*C2;s*Cl l/R3];
B=[l/R1;0];C=A\B;
y=abs(C(2));
15r--------,-------,,-------.--------,
10 ...
I
,.
l
I
-10 -·-···t
F1GURE 2 Sensitivities.
$ 0 ....... .
At sor.eHz
I
hlg, to low orctr Ia ;
R3.C . R2 .C2 ,R r ,
-loLo-----5-oo~.2~~5~o~o~.-4---5~oo-L-
_s---=s~o~o-.s~--~501
P'r.q (Hz)
20
l
15
10 ····+
! 5
.. . ...... i. ..
I
-5
FIGURE 4 RSS.
20,-------.--------,--------.--------,
- 1 ~oo~----~4~5~0~----~5~0~0~----~5~5~0~----6~00
Freq (Hz)
FIGURE 5 EVA.
38 Tolerance Analysis of Electronic Circuits
Hence the peaks are about 2.4 times the nominal output which is
about 8 Vat 490Hz, so that the peaks are 2.4 x 8 = 19.2 V, which
is approximately correct. For Vrss1, we have:
15r------,------~-------,------,
10 ...... .
-5
··········t
i ······················f
!
!
-1 0
···r···
FIGURE 6 Sensitivities.
40 Tolerance Analysis of Electronic Circuits
~ 0
-1r-----1------+------r-----+-~~~
R3, C , R2,C2 , ~
*
>
FlGURE 8 RSS.
Again, the RSS output is correct only in the sense the mathe-
matics is correct. It is misleading due to the misuse of the RSS
concept, i.e., the sensitivity-tolerance products are excessive.
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 41
20,------,-------.-------.------,
15
I
·······j..
I
·I······
I
... 1...
i
I
-5 i··· t. . . . . .
I
j··
I
- 1 ~o~o~--~4~5~0----~5~00~--~5~5~0~--~6oo
Freq (Hz)
FIGURE 9 EVA.
LOWPASS FILTER
Of course, not all ac circuit exhibit these somewhat disappointing
results. An example of a "well-behaved" circuit is the multiple feed-
back lowpass filter, the circuit for which is shown below.
R1
E1 V1
42 Tolerance Analysis of Electronic Circuits
= =
The component values are: Rl 1.43K, R2 14.3K, R3 = 9.09K,
= =
Cl 2nF, and C2 O.luF. Component tolerances are chosen as Tr
l [l
= =
0.02 and Tc 0.1 (symmetric).
Ignoring the opamp and setting V2 =0, the A and B matrices are
end
end
% get EVL
D=L2(Rl*L(i,1) ,R2*L(i,2) ,R3*L(i,3), .. •
C1*L(i,4),C2*L(i,S),s);
VL(i)=20*log10(D);
% get EVH
D=L2(Rl*H(i,l),R2*H(i,2),R3*H(i,3), ...
C1*H(i,4),C2*H(i,S),s);
VH(i)=20*log10(D);
% get rss
suml(i)=O;sum2(i)=0;
for p=1:N
sum1(i)=sum1(i)+(Sen(i,p)*(L(i,p)-1))A2;
sum2(i)=sum2(i)+(Sen(i,p)*(H(i,p)-1))A2;
end
Vrss1(i)=20*log10(Vs(i)*(1-sqrt(sum1(i))));
Vrss2(i)=20*log10(Vs(i)*(1+sqrt(sum2(i))));
end
'subplot(2,1,1)
h=semilogx(F,Sen(: ,1), 'k' ,F,Sen(:, 2), 'r', ...
F, Sen ( : , 3 ) , • g ' ) ;
hold on
g=plot(F,Sen(:,4), 'c',F,Sen(:,S), 'm');
set(h, 'LineWidth',l);set(g, ' LineWidth',1)
grid on
axis([10ABF 10A(BF+NO) -2 2])
ylabel('%/%', 'FontSize',Bl
title('Fig 10. LPF Sensitivities','FontSize',Bl
hold off
'
subplot(2,1,2)
m=semilogx(F,VL,'g',F,VH,'b ', F,Vrssl, 'k', ...
F, Vrss2, 'k' ) ;
set (m, 'LineWidth' , 1)
grid on
axis([10ABF lOA(BF+NO) -20 20))
xlabel('Freq (Hz)', 'FontSize',B)
ylabel('dBV', 'FontSize',B)
title('Fig 11. LPF EVA', 'FontSize',B)
44 Tolerance Analysis of Electronic Circuits
function y = L2(Rl,R2,R3,Cl,C2,s)
% fen for Butterworth LPF
A=[l / Rl+l / R2+1 / R3+s*C2 -l / R2;-l / R3 -s*Cl] ;
B=[l / Rl; O];C=A\ B;
y=abs ( c (2) ) ;
R1 C1
-1 .5 .. ..................... ······················-
-27---------------------~--------------------~
~ ~ ~
F... (HZ)
SPICE ANALYSIS
While the results of the EVAIRSS analysis for the BPF circuit are
disappointing, the Spice analysis is more so. Most present-day Spice-
derived analysis packages do not correctly calculate the ac sensitiv-
ities for EVA (.WCASE) analysis. ( Spice does not have ac or de
RSS capability.)
To show an example of this, the net-list below describes an
identical BPF circuit and specifies a .WCASE analysis. The output
files (filename.out) generated by this net-list, show that the sensis-
tivities are calculated at only one frequency, which gives incorrect
results. (In the author's version, the MIN run calculated the sensi-
tivities at 400Hz, while 501.01 Hz was used for the MAX run.)
Hence other ac circuits may also be incorrect
The reader should compare the probe plots of each run with that
of Figure 5.
C2 4 2 CA O.luF
E14 0 0 3 1E6
• As in MATI.AB, an ideal VCVS is used.
.MODEL RA RES(R=l DEV/GAUSS=0.667%)
=
• 3 sigma 2%
.MODEL CA CAP(C=l DEV/GAUSS=3.333%)
=
• 3 sigma 10%
.WCASE AC V(4) MIN VARY DEV
*.WCASE AC V(4) MAX VARY DEV
.AC LIN 100 400 600
.PROBEV(4)
.OPTIONS NOECHO NO PAGE
.END
C2
Ph(i)=(180/pi)*ang1e(G1)+180;
if Ph(i)>180;Ph(i)=Ph(i)-360;end;
for p=l:N
A=Ao*Q(p,5)/((l+s/(wl*Q(p,6)))* .•.
(l+s/w2)*(l+s/wJ));
B=(s+(l/(Rl9*Q(p,3))+1/(R6*Q(p,2))+ •• ,
l/(R4*Q(p,1)))/(C2*Q(p,4))) ...
/(s+l/(R19*Q(p,J)*C2*Q(p,4)));
GHr(i)=abs(A/B);
% sensitivities
SM(i,p)=((GHr(i)/GH(i))-1)/dpf;
end
end
'
subp1ot(2,2,1)
h=semilogx(F,M, 'k',F,Al,'k',F,Bl, 'k');
set(h,'LineWidth',1);grid on;
axis((10ABF 10A(BF+ND) -20 120))
xlabel('Freq(Hz) •, 'FontSize',8);
ylabel('dBV','FontSize',8);
title('Fig. 12, Bode Plot of gains','FontSize',SI
XT=1ogspace(BF,BF+ND,BF+ND+l);
set(gca, •xtick',XTI;
'
subplot(2,2,21
g=semi1ogx(F,Pb,'k');grid on;
set(g, 'LineWidth',1);
axis((10ABF 10A(BF+ND) -100 200))
xlabel('Freq(Hz)','FontSize',8);
ylabel('Phase (deg) •, 'FontSize',8);
title('Fig 13. Phase Angle','FontSize',8);
set(gca, •xtick' ,XT);
'
aubplot(2,2,3)
g=plot(Ph,M, 'k');grid on;
set(g, 'LineWidth',1);
axis((-100 200 -40 80))
xlabel('Phase•, 'FontSize',8);
ylabel('Mag (dBV) •, 'FontSize',8);
title('Fig 14. Mag vs Phase', 'FontSize',8);
'
Root-Sum-Square (RSS) and Extreme Value Analysis (EVA) 49
subplot(2,2,41
h=semilogx(F,SM(:,l),'k',F,SM(:,2),'k',F,SM(:,3));
set(h, 'LineWidth',l);
hold on;grid on
h=semi logx ( F, SM ( : , 4) , ' k' , F, SM ( : , 5 I , ' k' , F, SM ( : , 6) I ;
set(h, 'LineWidth',l);
hold off
axis([lQABF lQA(BF+ND) -1.5 1.5])
xlabel('Freq (Hz) •, 'FontSize',B);
ylabel('\/\', 'Fontsize',B);
title('Fig. 15 Sensitivities', 'Fontsize',BI
set(gca, •xtick' ,XT);
% SM = sensitivities
i f SM(i,p) >0
L(i,p)=l+T(l,p);H(i,p)=l+T(2,p);
else
L(i,p)=l+T(2,p);H(i,p)=l+T(l,p);
end
end
% get EVL
A=Ao*L(i,5)/((l+s/(wl*L(i,6))) •..
*(l+s/w2)*(l+s/w3));
B=(s+(l/(Rl9*L(i,3))+1/(R6*L(i,2))+1/ ...
(R4*L(i,l)))/(C2*L(i,4))) ...
/(s+l/(R19*L(i,3)*C2*L(i,4)));
GHL(i)=abs(A/B);
% get EVH
A=Ao*H(i,5)/((l+s/(wl*H(i,6)))* ...
(l+s/w2)*(l+s/w3));
B=(s+(l/(Rl9*H(i,3))+1/(R6*H(i,2))+1/ ...
(R4*H(i,l)))/(C2*H(i,4))) ...
/(s+l/(Rl9*H(i,3)*C2*H(i,4)));
GHH (i) =abs (A/B);
Ill get RSS
suml(i)=O;sum2(i)=O;
for p=l:Nc
suml(i)=suml(i)+(SM(i,p)*(L(i,p)-l))A2;
sum2(i)=sum2(i)+(SM(i,p)*(H(i,p)-l))A2;
end
Grssl(i)=GH(i)*(l-sqrt(suml(i)));
Grss2(i)=GH(i)*{l+sqrt(sum2(i)));
end
% create polar plot
h=polar ( [0 2*pi], [0 21);
delete(h);hold on
%g=polar(Ph,GH, 'k');set(g, 'LineWidth',l);
g=polar(Ph,Grssl, 'r');set(g,'LineWidth',l);
g=polar(Ph,Grss2, 'g');set(g, 'LineWidth',l);
g=polar(Ph,GHL, 'c');set(g,'LineWidth',l);
g=polar(Ph,GHH, 'b');set(g,'LineWidth',l);
gtext('Fig 16. RSS/EVA, Cx = 80pF')
hold off
52 Tolerance Analysis of Electronic Circuits
120,---,----.---.----.---.----,---,
60
40
20 ···-·······t··
···
0
I
···········!··········
J ···r····-..-
. . . .J . . !...........!......-..
150 . !
100 ············f···
..
I ~ i I
r······1. 1 ., . .
50
I . J.. 1 I I
- 50
r··· · ······-r ·t·······j·······l
-100L---~--~--~----L---~--~--~
1~ 1~ 1~ 1~ 1~ 1~ 1~ 1~
F.-q(Hz)
EIO ······---~--
4o ·····-···----········--------L
...
,
i 20
l
0 ...................... .. . ........ I..... .
-!~o~o--~------o~---------1~00----------2~00
1.5r---.----,----,----,----,---,----,
I
0.5 [..........i
-0. 5
-1.5 L-:-----'-----'-::---~---'-----'-=-----'----'
1~ 1~ 1~ 1~ 1~ 1~ 1~ 1~
Fr.q(Hz)
FIGURE 15 Sensitivities.
54 Tolerance Analysis of Electronic Circuits
90
180
270
The polar plot output from this M-file shown in Figure 16. The two
outer traces are high and low EVA plots, while the inner traces are
high and low RSS outputs. The phase margin is 180° minus the angle
where these traces cross the unity gain circle. The lowest is about
10°, far below the 45° target value.
The reader is encouraged to change the value of Cx from 80pF
to 200pF and observe the increase in the minimum phase margin.
2 Monte Carlo Analysis
55
56 Tolerance Analysis of Electronic Circuits
The following MA1LAB file shows how create and use what
should more accurately be called psuedo-random numbers, but will
be referred to as random numbers.
0
Tl(z) = ·~ ·(z+3)-0.02+1 =(0.0067)(4.521)+0.98= 1.101
0 3
T2(z) = ·~ ·(z+3)-0.0l + 1 =(0.005)(4.521)+0.99+1.0126
0
T3(z)= ~3 ·(z+3)-0.02+ 1 = (0.005)(4.521)+0.98 = 1.0026
TI(zu) = 0.04(zu)-0.98
and correspondingly for T2 and T3.
We next perform a MCA on the de differential amplifier of Part
1 and compare the results to the RSS and EVA analysis of that simple
circuit. We will use both normal and uniform distributions and com-
pare the histograms for each (see Figures 18 and 19).
The steps outlined below are before the analysis is perfomed:
% File figl819 . m
% de differential amplifier
% functions not used
clear;clc;
% Step 1 - assign component values
R1=10;R2=100;R3=10;R4=100;E1=-1;E2=1;Ao=le6;
% Step 2 - create A matrix & B input vector
A=[l/R1 + l/R2 0 0 -1/R2;
1 -1 0 0; 0 0 l/R3 + 1/R4 0;0 Ao -Ao 1];
B=[El/Rl;O;E2/R3;0];
% Step 3 - optional;
% calculate nominal output
C=A\B;Vo=C(4);
% Step 4 - specify N number of samples
% and M components
N=5000;M=6;
% Step 5 - seed for random numbers
randn('state',sum(lOO*clock));
Tn=zeros (N,M);
% Step 6 - create tolerance array T;
% convert to tolerance multipliers
Tolerance Analysis of Electronic Circuits
21 .5
= =
Hence the 3a value for Figure 19 is 31i Ys1 1.732(0.766) 1.327
iH.325. The closer the output approaches Guassian, the better this
approximation is.
Figures 20 and 21 were created with the same M-file, but with
N = 10000 samples and -1%/+3% asymmetric resistor tolerances
used for Rl and R3. (See pages 9 and 10).
Referring to Figure 20 with the asymmetric tolerances, it will
be recalled that the RSS analysis predicted that these limits would be
1~r------.-------.-------r------,-------.------.
~~ ················· ..··-·······;
.....................
21.5
1be EVA numbers for this case were l8.262V and 2l.424V. 1bese
numbers together with % deviation from the MCA numbers are
summarized in the table below for easy comparison.
The conclusion is that Vrss is a better estimator than Vrs and much
better than EVA.
=
Uniform: N 5000 k =l..N Tu(k) = 3( 2 ·(rand) -1]
These extremes are called outliers and their use in MCA implies the
analysis is being performed with out-of-spec components which is
unrealistic, especially in a manufacturing yield analysis. Also, MCA
with uniform inputs could serve as a happy compromise between the
EVA and RSS philosophical camps.
RATIOMETRIC TOLERANCES
In integrated circuits, tolerances for ratio tracking components are
expressed in a different manner. There are two tolerances associated
with a ratio of resistors. One is the individual tolerance T1 of either
resistor which may be quite large. The other is the ratio tolerance
T2 of this resistor to another, which is usually much smaller.
Monte Carlo Analysis 67
R2 10
K=-=-=5
Rl 2
and 2.6, so that K does not exceed 5.25 per the advertised ratio
specification.
\ File daratio.m
\ de differential amplifier
\ - ratiometric
clear;clc;
Rl=l0;R2=100;R3=10;R4=100;El=l;E2=-l;
Kl=R2/Rl;K2=R3/R4;
N=SOOO;M=4;
randn('state',sum(lOO*clock));
Tn=zeros (N,M);
\ Ratio tolerances
Tr=O.Ol;Te=O.OS;
T=[-Tr -Tr -Te -Te;Tr Tr Te Te];nb=25;
for mc=1:2
for k=l:N
for w=l:M
if mc==l
Tn(k,w) =I (T(2,w) -T (l,wl l /6) .•.
*(randn+3)+T(l,w)+l;
else
Tn(k,wl= (T(2,wl -T(l,wl l ..•
*rand+T (l,w) +1;
end
end
A=Kl*(Tn(k,l));B=K2*(Tn(k,2));
vm(k)=El*Tn(k,3)*{l+A)/(l+B)-E2 .••
*Tn(k,4)*A;
end
if mc==l
Vs1=3*atd(vm);Vavgl=meanlvml;
hl=hiat(vm,nbl ;VLl=minlvml;
VHl=max 1vm1 ;
intvl=IVHl-VLll/nb;
for q=l:nb;binl(q)=VLl+intvl*(q-l);end
Vhil=Vavgl+Val;Vlol=Vavgl-Vsl;
Vsrzsprintf('\2.3f\n',Vsl);
Vavgrssprintf ( '\2. 3f\n', Vavgl);
else
Vs2=3*std(vm);Vavg2=mean(vm);
h2=hist(vm,nbl;VL2=min(vm);
VH2=maxlvml;
intv2=1VH2-VL2)/nb;
for q=l:nb;bin2(q)=VL2+intv2*(q-l);end
Monte Carlo Analysis 69
Vhi2=Vavg2+Vs2;Vlo2=Vavg2-Vs2;
Vsu=sprintf('%2.3f\n',Vs2);
Vavgu=sprintf('%2.3f\n',Vavg2);
end
end
subplot(2,1,1)
bar(binl,hl, 'y');
title('Fig 22. Ratiometric MCA, Normal dist');
grid on;
axis([18.5 21.5 0 700]);
text(20.5,450, ['Vavgl=',Vavgr]);
text (20.5,400, ['Vsl=',Vsr]);
%
subplot(2,1,2)
bar(bin2,h2, 'y');
title('Fig 23. Ratimetric MCA, Uniform dist');
xlabel ( 'Volts de' )
grid on;
axis([18.5 21.5 0 700]);
text (20.5, 450, [ 'Vavg2=', Vavgu]);
text (20. 5, 400, [ 'Vs2=' ,Vsu]);
700,------.-------.-------.------.-------.------.
600
21 .5
Note that the 3cr values Vsl and Vs2 are slightly Jess than that shown
in Figures 18 and 19 for non- ratiometric resistors.
R1
Monte Carlo Analysis 71
Vo =(vos+lbl·(RII/R2)-lb2·(R3//R4))(t + ~~)
1 1 El_lbl
-+- 0 0
Rl R2 R2 Rl
-1 0 0 Vos
A= , B=
I I E 2 -lb2
0 0 -+- 0
R3 R4 R3
0 Ao -Ao 0
Note that the initial values of Vos, lbl, and lb2 are one times the
unit (i.e, InA, lmV). Hence these numbers could be lpA and IV.
The tolerances in the last three columns of array T are then the data
sheet max values of Vos, lb and los in which:
\ File offsets.m
\ de opamp offsets
\ uses MATLAB function G6.m
clear;clc;
R1=10000;R2=20000;R3=10000;R4=20000;
El=O;E2=0;Ao=le6;
Vos=0.001;Ib1=1e-9;Ib2=1e-9;
\ Vos in mV; Ib1 • Ib2 in nA
\ must be 1 x tolerance unit,
\i.e., Vos = 2.SmV, etc.
\ Step 2 - create A matrix;
\ add offset sources to B; E1=E2=0
Vo=G6(R1,R2,R3,R4,E1,E2,Vos,Ib1,Ib2,Ao);
N=SOOO;M=7;
randn('state',sum(100*clock));
Tn=zeros (N, Ml ;
Tr=0.01;
T=[ -Tr -Tr -Tr -Tr -10 -150 -50;
Tr Tr Tr Tr 5 100 30];
\ Vos -10mV/+SmV;
\ Ib1 -150na/+100nA;
t Ib2 -50na/+30nA
nb=25;
for mc=1:2
for k=1:N
for w=1:M
if mc==1
Tn(k,w)=((T(2,wl-T(l,w))/6)* ...
(randn+3l+T(1,w)+1;
else
Tn(k,w)=(T(2,w) -T(1,w)) * ...
rand+T(l,wl+l;
end
end
Vm(kl=G6(R1*Tn(k,1),R2*Tn(k,2), •..
R3*Tn(k,3),R4*Tn(k,4), .•.
E1,E2,Vos*Tn(k,S),Ib1*Tn(k,6), ...
Ib2*Tn(k,7),Ao);
end
if mc==l
Vs1=3*std(Vm);Vavg1=mean(Vm);
h1=hist(Vm,nb);VLl=min(Vm);
Monte Carlo Analysis 73
VHl=max (VDI) ;
intvl=(VHl-VLl)/nb;
for q=l:nb;binl(q)=VLl+intvl*(q-l);end
Vhil=Vavgl+Vsl;Vlol=Vavgl-Vsl;
Vsr=sprintf('%2.3f\n',Vsl);
Vavgr=sprintf('%2.3f\n',Vavgl);
else
Vs2=3*std(VDI);Vavg2=mean(vm);
h2=hist(VDI,nb);VL2=min(VDI);VH2=max(VDI);
intv2=(VH2-VL2)/nb;
for q=l:nb;bin2(q)=VL2+intv2*(q-l);end
Vhi2=Vavg2+Vs2;Vlo2=Vavg2-Vs2;
Vsu=sprintf('%2.3f\n',Vs2);
Vavgu=sprintf('%2.3f\n',Vavg2);
end
end
subplot(2,1,1)
bar(binl,hl, 'y');
sl='Pig 24. Opamp offsets MCA, Normal dist•;
title(sl);
grid on;
axis([-0.04 0.04 0 600]);
text(-0.03,450,['Vavgl=',Vavgr]);
text (-0.03,400, ['Vsl=',Vsr]);
'
subplot(2,1,2)
bar(bin2,h2, 'y');
s2='Fig 25. Opamp offsets MCA, Uniform dist';
title(s2);
xlabel('Volts de')
grid on;
axis([-0.04 0.04 0 600]);
text(-0.03,450, ['Vavg2=',Vavgu]);
text(-0.03,400, ['Vs2=',Vsu]);
For Gaussian inputs, the histogram Figure 24 shows that the +3a
= =
output is Vavg + Vsl -SmV + 22mV 18mV. The histogram of
Figure 25 approximates a uniform distribution. The calculated +3a
point is Vavg + Vs2 = -SmV + 40mV = 35mV. Since the output
distribution is non-Gaussian, the calculated 3a number does not
74 Tolerance Analysis of Electronic Circuits
0.03 0.04
0.04
mean much. Note however, that the extreme right-hand bin is about
18mV, the same as the extreme right-hand bin for Figure 24. The
same applies to the extreme left-hand bins.
Monte Carlo Analysis 75
end
end
D=G2(Rl*Tn(k,l),R2*Tn(k,2),R3*Tn(k,3), .•.
R4*Tn(k,4),R5*Tn(k,5), •.•
R6*Tn(k,6),R7*Tn(k,7),RB*Tn(k,B), •..
R9*Tn(k,9),RT*Tn(k,10),El*Tn(k,ll),Ao);
Vlll(k)=D;
end
if mc==l
Vsl=3*std(Vlii);Vavgl=mean(Vlll);
hl=hist (VIII, nbl ; VLl=min (VIII) ; VHl=max (VIII) ;
intvl=(VH1-VL1)/nb;q=l:nb;
binl=VLl+intvl*(q-1);
Vhil=Vavgl+Vsl;Vlol=Vavgl-Vsl;
Vsr=sprintfl''2.3f\n',Vs1);
Vavgr=aprintf(''2.3f\n',Vavg1);
else
Va2=3*std(Vlii);Vavg2=mean(VIII);
h2=hiat (Vm, nb) ;VL2zmin (VIII) ;VH2=max (VIII);
intv2=1VH2-VL2)/nb;q=l:nb;
bin2=VL2+intv2*(q-1);
Vhi2=Vavg2+Vs2;Vlo2=Vavg2-Vs2;
Vsu•sprintf(''2.3f\n',Vs2);
Vavgu=aprintf(''2.3f\n',Vavg2);
end
end
subplot(2,1,ll
bar(binl,hl,l,'y');
title('Fig 26. RTD MCA, Normal dist');
grid off
axis([3.9 4.7 0 BOO]);
text(3.95,450,['Vavgs',Vavgr]);
text (3.95,300, ['Vs=',Vsr]);
'
subplot(2,1,2)
bar(bin2,h2,l,'y ' );
title('Fig 27. Uniform dist');
xlabel ( •Volts de • l
axis([3.9 4.7 0 BOO]);
text(3.95,450, ['Vavg=',Vavgu]);
text(3.95,300, [ 'Vs=' ,Vsu] l;
Monte Carlo Analysis 77
function y = G2(R1,R2,R3,R4,RS,R6,R7,R8,R9,RT,E1,Ao)
% mea for rtd function
A=[1 / R1+1 / R4+1 / RT -1 / RT - 1 / R4 0 0 0 -1 / R1; .. .
-1 / RT l / R5+1 / R6+1 / RT 0 -1 / RS 0 0 0; .. .
-1 / R4 0 1 / R2+1 / R3+1 / R4 0 -1 / R3 0 0; . . .
0 -1 / RS 0 1 / R5+1 / R7 0 0 0; ...
0 0 Ao - Ao 1 0 0; ...
0 0 0 0 0 1 / R8+1 / R9 -1 / R9; .. .
0 0 0 0 0 Ao 1);
B=[O;El / R6;E1 / R2;0;0;E1 / R8;0);
C=A \ B;y=C(S);
The MCA numbers for Figure 26 (normal dist) are Vavg1 - Vs1 =
4.343-0.189 = 4.154V and Vavg1 + Vs1 = 4.532V. These numbers
are within 0.36% and 0.11% of the RSS numbers calculated in Part
I (4.139V and 4.527V). Hence the Vrss method of de RSS analysis
in Part I has been verified empirically if not rigorously.
4.8
function y = B2(Rl,R2,R3,Cl,C2,s)
'II function for MFBPF
Nl=l/(Rl*Cl);Dl=(l/Cl+l/C2)/R3;
D0=(1/Rl+l/R2)/(R3*Cl*C2);
y=abs(Nl*a/(sA2+Dl*s+D0));
15r---~--.----,------~~--,---,----.---.---,
•1000
~ ---
FIGURE 31
~
Freq(Hz)
~ ~
Answer: 2H where N = 3.
1010101]
0110011
0 0 0 1 1 1 1
which gives:
=
Now pick out the min and max values: min(Vm) 7.053, max(Vm)
= 7.953.
Using this scheme, the following MATLAB file fmcadiff.m performs
the FMCA on our ubiquitous de diff amp.
Monte Carlo Analysis 87
Vm(k,i)=abs(N12(k)*s / . ..
(s A2+D12(k)*s+D02(k)));
end
end
Vmax=max (Vm) ;
subp1ot(1,1,1)
h=p1ot(F,Vmax, 'k',F,Vo, 'k');
set(h, 'LineWidth',2);grid on
axis ([BF LF 0 15])
xlabel('Freq(Hz) ');ylabel('Volts')
title('Fig 34. BPF FMCA')
s1='N = ';s2= ' Vpk = ';
text (410, 11, [s1,num2str (N)], 'FontSize', 8);
Vpk=max (Vmax) ;
text(410, 13, [s2,num2str(Vpk)], 'FontSize', 8);
The most glaring change in Figure 34 from the EVA plot in Figure 5
is the maximums in the vicinity offo =500Hz. Hence the EVA plot
did indeed omit much crucial tolerance analysis information. Note
however, that the extreme center frequencies show up to be consistent
with the EVA plot, i.e., 447Hz and 568 Hz. This is not a general
rule and an exception to this will be shown. Once again, it appears
that RSSIEVA analysis for ac circuits in general is not worthwhile.
There are exceptions to this as we have seen with the Butterworth
LPF.
Thus a conservative tolerance analysis method for ac circuits is
to do a FMCA and a uniform distribution MCA with N at least 1000,
preferably more. The advantage of this recommended approach is
shown in the following analysis of the BPF.
Figures 35 and 36 show all the required tolerance analysis infor-
mation in one plolln Figure 35, there are only N = 100 samples for
MCA., while in Figure 36 the difference with N = 5000 is obvious.
The dotted traces in both plots show the FMCA, or the maximum
envelope of the circuit response. Note the difference between the
MCA peak (Vpk) in both cases, and that the FMCA peak (Vfpk) is
the same.
('The M-file fmcabpf3.m used to create Figures 35 and 36, is
given in the Appendix.)
Note the two interior valleys of the FMCA analysis (dotted
traces) at 475Hz and 530Hz. These points represent 2 combinations
of the 25 = 32 extreme tolerance combinations. The MCA plot is
well above these valleys with some random combination of toler-
ances less than the extreme tolerances. Hence, output magnitudes
can be greater at smaller tolerances. This is a subtle characteristic
of some so-called "extreme value" analyses.
The reader can now understand that a true EVA, for this circuit
at least, can only be obtained via MCA using an infinite number of
samples. As in most statistical analyses, an EVA can only be esti-
mated, the accuracy of which improves as N is increased.
Monte Carlo Analysis 91
Vl*· ~ 1.2715
V\* ~ 11.4531
N•~
10 ............ .:
6 --
600
E1
-1oL-------~-------L------~------_J
400 450 500 550 600
fj"r.q (HZ)
FlGURE 39 RSS.
-10L_______J ________L______~--------
400 450 500 550 600
Freq (Hz.)
FlGURE 40 EVA.
Monte Carlo Analysis 95
/ !
""" \
6.5
I
5
. ............. ...........
/'
\
5.
5 .. ........... I ; . .. ....... - -
5 ................ ........... i/ \.
r. . ................... / '\. ..
/ :
4 ..
3.5
v / T -t·- .
'~ ........
5V;. . .
.......
3
~
;.............. ..
i
2.
2
i i
400 420 440 460 460 500 520 540 560 560 600
fo=
this is done, the center frequency using the above formula is fob =
557 Hz, precisely the answer the EVA gives us for the high center
frequency.
In FMCA, all possible combinations of tolerances are tried, so
we recalculate using all low tolerances. The only change here is the
sign of R3. The new center frequency calculates to fah = 568 Hz,
which is what the high-center frequency is in Figure 41. Thus the
difference.
Why didn ' t this happen with the multiple feedback BPF? The
center frequency expression for this filter is the same; the difference
is in the sensitivities. For the multiple feedback BPF at greater than
fo = 500 Hz, the signs for all five components are minu~ . Hence we
get 568Hz again.
The next question concerns the MCA plot. In a functioning
circuit, how could those peaks be greater than 350 volts? (Making
several runs of the file, peaks as high as lOOOV were obtained.)
Using matrix analysis, it would be very difficult to discover the
reason for these peaks. The answer lies in the transfer function. With
u = 1 + R5/R4 subsituted, Nl, Dl, and DO are as shown below:
98 Tolerance Analysis of Electronic Circuits
where
l+R5
Nl=~
Rl·Cl
= =
First note that at the center frequency DO mo, Yo Nl/01. We
next create three tolerance multipliers for resistors R2, R4, and R5,
at or within their ±2% range:
Let a= 0.982 be a multiplier for R2; b = 1.02 for R5, and c =
0.9816 for R4. The following MATI...AB routine spike.m calculates
the gain with these multipliers:
OELYIANNIS BPF*
E1 "' ..'
~1----0.--1
V1
V4
• From Reference 2.
Monte Carlo Analysis 101
1400
1200 ............ .................
1000
800
•11
800
c-·····
v \
)~ ~
200
- .::.::.··..... .........
·· ····--
..--::: ·::;/
-----
__-:..-::: f------~- - - .........
'-:'
~-----
..:.;.
;-----+-----
1400r---.---.----.---,---.----.---.----.---,---.
C4 C6
R5r1
111 113
E1 V3
C2
IV2 .l~ R7
= = =
Rl 267K; R3 267K; R5 133K; R7 1M; C2 = =0.02uF; C4 =
O.OluF; C6 = O.OluF; Tr = 0.02; Tc = 0.1
N2 =_1(_!_+_1)
C2 Rl R3
Nl=-~-[-1 (-1 +-1)]
Rl·R3 C2 C4 C6
NO=DO=---------
Rl·R3·R5·C2·C4·C6
Monte Carlo Analysis 103
-10
t"------
-1
5 ------ :
~ l--::::::: ~
-20
--,,_ ~--~ ~--·
~/---
~--..•.----- ~ -?
i
-25
',,, v ,
/
-30
\, !-'
r---
N-100
I\. /
\j
50 55 eo 70 75 eo
FIGURE 46 Twin-T FMCA/MCA.
-1 0
-1
~ I
------~-:~
-- =
5
, ~ ~ -- -- ---
1~
___
"' /----
-2 ~ l-~::::· - -
~-.- ·:/ ~
0 '',,,
-25
R2
Transfer function :
Nl=~ D1 l DO=-----
Rin ·C2 ' = Rq ·C2' Rl ·R2 ·Cl ·C2
C2
All-pass phase angle designed for 'Tt/2 or 90% at 500 Hz; constant
gain= 0.9 VN. Rl = 619, R2 = 22.6K, R3 = 24.9K, R4 = 226K,
Cl = O.luF, C2 = O.luF.
106 Tolerance Analysis of Electronic Circuits
' i l
90 ········--····~·-·--·--···-····~--------·-··--!- ..··-----~----· ...... ········+-··-······..-·
... ___ '
7~50 -460 470 -460 490 500 510 520 530 540 550
I EI
-+s(CI+C2} -s·CI 0 -s ·C2
RI RI
I
-s ·CI -+s ·CI 0 0
A= R2 R2 B=
0 0
I
-+-
I
0 -EI
R3 R4 R3
0 -Ao Ao 0
k-·
190
f
;,
' r':·r··--
170
;::-- t·--.
I··
t--- ~ t··.....t- .
:------
- - - r------
0
~
~
-
~---,r"
N ~1000
90
f.. -
7~ 470 480 490 500 510 520 530 540 550
Fr.q(Hz)
2
we= 27tfc Nl= wc ·R2 Dl= wc ·R2 DO (wc) ·R2
50 ' Rl ' R3 ' R4
2
R 2 = HRlwo , R4 =R"rwc] , R3 wcQR2
Qwc 1wo wo
1 . 2r---~----~----r---~-----.----r----.-----.----,----,
1 . 2.--,----,-----,~-,-----.--,---,----,----.----,
' t : rt '
! .•·'· ------.•n.·.--;,
··· ··· ··--- -~----------1'~-- · .... + .. +.
~~ ~\ --------:~,·\•. ·-···----..• ~-
i! . L---U
. !i
1\ . ~ /11
...,!.... i,· . ..
~-- .---ini. ~~ ..........L.i\.
. .. ... ·;i..... ~.· ·--'.,'.
~ j]\ ; !\ ' ;
· ·\ft·t !
\ i j 1 · ·-·r tt
f \ f. .,-~il. \,~·.il· · · ·~~\.•, ,. . .,. . . .+ ..............+ ........... ....~
....l.. !_;_J·. .
RJ
El
~~ +s(C1+C2} -sC2 0 0
Rl
0
1 1
-sC2 R2 +s(C2+C3} -sC3 0 0
R2
A
0 -sC3 ~3tsC3 0 0 0
0 0 0 -1 0
0 0 0 0 -~-~_I
R4 R5 R4
0 0 -1 0 0
aC1
0
1
R3
B
0
0
Monte Carlo Analysis 111
10,-----.-----.-----.-----.-----.-----.-----.-----.
·20 .
..,&;
-30 .
~~o----~4~5----~~~--~5~5----~----~5~5----~7~0-----7~5~--~~-
10r-----.-----.-----.-----,-----,-----,-----.-----.
The dR's are differentials and thus are infinitesimally small and
approach zero. When the dR's are set to the component tolerances,
this is stretching the definition somewhat. Thus with large component
tolerances and sensitivities, RSS becomes a poor estimator and
should not be used.
The RSS method is also defined as the variance of a (linear or
non-linear) function in Reference 7.
113
114 Tolerance Analysis of Electronic Circuits
au au
dU=- ·dX+- ·dY+- ·dZ
au
ax av az
=
Applying this to a set of measurements, let Ax dX, /iy = dY, and
&I. =
dZ, be a set of residuals of the measured quantities. Then letting
/iu = dU
au.= (au)
2 2 .,(au)(au)A. (au)z z
ax Ax.+"\.ax ayr•tJ.y.+ ... + az tJ.z.
~=(au)
2
~+(au)
2
n-1 ax n-1 ay
~+(au)z
n-1 az
~
n-1
or
( )z ( )z (au )z
2 au au 2 2 2
a. = ax a.+ ay a,+ az a. Q.E.D.
Note that gain G is involved in S12 only. Also note the only difference
between Sc1 and S0 is the sign of the wol term in the numerator.
VALUES AT M =WO
Su(wo) =0 Slll(wo) =+1 Sc1(wo) =+lf.z Scz(wo) =~
Compare these numbers with the zoomed plot of the sensitivities
shown in Figure 7.
wo fi _ fo ·Q _
fio = 2x • r3 - ~Qz -1 • .c1 -
& f~-1 &c __ fo ·Q:/2
2 • ,, 2 ~2Qz -1
AppendiX 117
For Rl:
For R3:
fr3v=fo~ Q-1
Q , fr3p=fo~ Q
Q+l
fr3v=513.6Hz. fr3p=488.54Hz
For Cl:
fclv=fo
2Ql+~
~ fclp=fo
2Q2 ~
-~
2Q -1 ' 2Q2 -l
" 1 ·~ 500.1 500.2 500.3 500.4 500.5 500.6 500.7 500.8 500.9 501
Freq(Hz)
From the table below, we choose the two numbers in the 5000
column A =0.9808 and B = 1.0200. Then with 95% confidence the
true Vo + 3cr value is between Vo + Vs·A and Vo + Vs·B, or 20 +
0.756(0.9808) = 20.741V and 20 + 0.756(1.0200) = 20.771V, and
similarly for Vo - 3cr.
For 95% confidence level for the mean Vavg = 19.999V we
choose the number C in the 5000 column. Then the 95% confidence
level the true mean is between Vavg- Vs·C and Vavg + Vs·C or
120 Tolerance Analysis of Electronic Circuits
PERCENT YIELD
It is a relatively simple matter to place fail counters in any of the
MCA M-files. Then percent yield can be calculated as lOO*number
failed/number of samples. An outer loop of component tolerances
can be constructed to give percent yield at each tolerance. The
following M-file pcyield.m shows a simple example.
for r=l:3
% clear fail counters
flo=O;fhi=O;
Tr=r/100;Te=0.05;
Trm(r)=Tr;Tem(r)=Te;
T:[ -Tr -Tr -Tr -Tr -Te-Te; .. .
Tr Tr Tr Tr TeTe];
for k=l:N
for w=l:M
Tn(k,w)=((T(2,w)-T(l,w))/6)* .••
(randn+3)+T(l,w)+1;
end
Vm(k)=DA2(Rl*Tn(k,1),R2*Tn(k,2), .•.
R3*Tn(k,4),R4*Tn(k,4), ...
El*Tn(k,5),E2*Tn(k,6),Ao);
% catch high failures
if Vm(k)>UL;fhi=fhi+l;end
% catch low failures
if Vmlkl<LL;flo=f1o+l;end
end
NFH(r)=fhi ; NFL(r)=flo;
pcy(r)=100*(1-(fhi+flo)/N);
Vs=3*std(Vm);Vavg=mean(Vm);
Vhi(r)=Vavg+Vs;Vlo(r)=Vavg-Vs;
end
diary( 'OUtput. txt')
LM
MV= [Trm; Tem;Vlo;Vhi;NFH;NFL;pcy]
diary off
MATHEMATICAL CURIOS
AN "AccuRAn:" CANCER TEn-
Assume a test for cancer is advertised as 98% acccurate: Ta 0.98 =
Further assume that out of N people tested, 0.5% have cancer:
N = 10000; Cr = 0.005
R= lOO·Tfp =19.76%
Tfp+TFp
• From J.A. Paulos,IMWMracy, Vintage Books, 1990. Dr. Paulos also relates
a story about a television weatherman who made the rather surprising state-
ment: "We have a SO... chance of rain on Saturday and SO... chance of rain
on Sunday. That means there is a 1~ chance of rain this weekend."
Appendix 123
EASTER DATES
For example, the date of Easter in the year 2016 is March 27. Hence,
Easter can be classified as a "moveable feast."*
Programs that calculate the number of days between dates are com-
mon. However, programs that calculates the number weekdays
between two dates are not well known. The following M-file will
calculate the number of weekdays between to dates in
MM.DDYYYY format. Example: Mar 25, 1998 becomes 3.251998.
The following function is required:
function c = frac(x)
c = x-floor (X) ;
d(k)=floor(M(k)*30.6);
C(k)=floor(O(k)+Y(k)/le4-a(k)+b(k));
W(k)=(d(k)+C(k))/7;F(k)=floor(W(k));
G(k)=floor(l2.6l*frac(W(k)))/10;
H(k)=S*(F(k)+G(k));
end
WD=round(abs(H(l)-H(2)))
M-FILE LISTINGS
For Figures 35 and 36:
for nc=1:2
if nc==l
Nm=lOO;
else
Nm=SOOO;
end
for p=l:Nm
for w=l :M
Tn(w,p)=(T(2,w)-T(l,w))*rand+T(l,w)+l;
end
end
for i=l:Lit
s=2*pi*F(i)*j;
if nc==l
Vo(i)=B2(Rl,R2,R3,Cl,C2,s);
for k=l:Nf
Vf(k,i)=B2(Rl*Tf(l,k),R2*Tf(2,k), ...
R3*Tf(3,k),Cl*Tf(4,k),C2*Tf(5,k),s);
end
end
for p=l:Nm
vm(p, i)=B2(Rl*Tn(l,p),R2*Tn(2,p), ...
R3*Tn(3,p),Cl*Tn(4,p),C2*Tn(5,p),s);
end
end
if nc==l
VmaXl=max(vml ;VmaX3=max(Vfl;
Nl=Nm;clear vm;
else
VmaX2=max(vm);N2=Nm;
end
end
subplot(2,1,1)
h=plot(F,VmaX3 , 'k.:',F,Vo, 'k--',F,VmaXl, 'k');
set(h,'LineWidth',2);grid on
axis ([BF LF 0 15])
ylabel ('Volts')
title('Fig 35. BPF FMCA/MCA')
text(410,ll,['N == ',num2str(Nl)),'FontSize',8);
~kl=max(VmaXl);~k3=max(VmaX3);
text(410,13,{'~k = •,num2str(~kl)],'FontSize',8);
text(410,12, ['Vfpk = ',num2str(~k3)],'FontSize',8);
'
Appendix 127
subplot(2,1,2)
h=plot(F,Vmax3,'k.:',F,Vo,'k--',F,Vmax2,'k');
set(h, 'LineWidth',2);grid on
axis ([BF LF 0 15])
xlabel( 'Freq(Hz) ') ;ylabel( 'Volts')
title('Fig 36. BPF FMCA/MCA')
text(410,11, ['N = •,num2str(N2)], ' FontSize',8);
VPk2=max (Vmax2) ;
text(410,13,['Vpk = ',num2str(Vpk2)], 'FontSize',8);
sl= 'Vfpk = •:
text(410,12,[sl,num2str(VPk3)],'FontSize',8);
function y = B2(Rl,R2,R3,Cl,C2,s)
% function for MFBPF
N1=1/(Rl*Cl);Dl=(l/Cl+l/C2)/R3;
D0=(1/Rl+l/R2)/(R3*Cl*C2);
y=abs(Nl*s/(s~2+Dl*s+DO));
Sen(ilp)=((Vr(ilp)/Vo(i))-1)/dpf;
i f Sen(i 1p)>0
L(i 1p)•1+T(l 1p);H(i 1p)=l+T(2 1p);
else
L(i 1p)•l+T(2 1p);H(i 1p)=l+T(1,p);
end
end
' get RSS
suml(i)•O;sum2(i)=O;
for p•l:Ne
suml(i)=suml(i)+(Sen(ilp)*(L(ilp)-1))~2;
sum2(i)=sum2(i)+(Sen(i~p)*(H(ilp)-1))~2;
end
Vrssl(i)=Vo(i)*(l-sqrt(suml(i)));
Vrss2(i)=Vo(i)*(l+sqrt(sum2(i)));
' get EVL &: EVH
VL(i)=G3(Rl*L(ill)IR2*L(i 12) 1R3*L(i 13), ••.
R4*L(i~4l~RS*L(i,S),Cl*L(ii6)1C2*L(i 1 7) 1 s);
VH(i)=G3(Rl*H(i 1l)IR2*H(i 12) 1R3*H(i 13) 1 ..•
R4*H(ii4)1RS*H(ii5)1Cl*H{ii6)1C2*H{il7) 1 s);
end
'
subplot(2,211)
h=plot ( F 1 Sen ( : 1 1) 1 ' k' 1 F 1 Sen ( : 1 2) 1 ' r ' , .•.
F 1 Sen ( : 1 3) 1 ' g' ) ;
hold on
g=plot(FISen(:l4)1 'b');
set(h~'LineWidth'll);set(gi'LineWidth' 1 l)
grid on
axis([BF LF -20 20))
ylabel(''''','FontSize',B)
s1•'Fig 37. Sensitivities; R1,R2 1R3,R4';
title(sll 'FontSize',B)
hold off
'
subplot(2,212)
h=plot ( F 1 Sen ( : 1 5) 1 ' k' 1 F, Sen ( : 1 6) I ' r ' I • • •
F 1 sen< : 1 7 l 1 • g • l ;
set(h, 'LineWidth',l);
grid on
axis([BF LP -20 20))
ylabel('''''l 'FontSize·~Bl
s2='Fig 38. Sensitivities; RSIC1 1C2';
Appendix 129
title(s2, 'FontSize',8)
'
subplot(2,2,3)
m=plot(F,Vrssl, 'k',F,Vrss2, 'k',F,Vo,'r');
set(m,'LineWidth',l)
grid on
axis([BF LF -10 20])
xlabel('Freq (Hz)','FontSize',8);
ylabel('Volts','FontSize',8)
title('Fig 39. RSS','PontSize',8)
'
subplot(2,2,4)
m=plot(P,VL, 'k' ,P,VH, 'k' ,F,Vo, 'r');
set(m,'LineWidth ' ,l)
grid on
axis([BF LP -10 20])
xlabel('Freq (Hz)','FontSize',8);
ylabel('Volts','PontSize',8)
title('Fig 40. EVA','PontSize',8)
function y = G3(Rl,R2,R3,R4,R5,Cl,C2,s)
\ fen for sallen & key transfer function
Nl=(l+RS/R4)/{Rl*Cl);
Dl={l/Rl-RS/{R2*R4)+2/R3)/Cl;
D0=(1/Rl+l/R2)/(R3*Cl*C2);
y=abs(Nl*s/(s~2+Dl*s+D0));
\ Start ac analysis
Lit=(LP-BF)/DF+l;
F=linspace(BF,LF,Lit);
for i=l:Lit
S20+2*pi*F(i)*j;
Vo(i)=G3(Rl,R2,R3,R4,R5,Cl,C2,s);
for p=l:Nc
Vr(i,p)=G3(Rl*Q(p,l),R2*Q(p,2), .••
R3*Q{p,3),R4*Q(p,4),R5*Q{p,5), •••
Cl*Q(p,6),C2*Q(p,7),s);
Sen(i,p)=((Vr(i,p)/Vo(i))-1)/dpf;
if Sen(i,p)>O
L(i,p)=l+T(l,p);H(i,p)=l+T(2,p);
else
L(i,p)•l+T(2,p);H(i,p)=l+T(l,p);
end
end
\ get EVH
VH(i)=G3(Rl*H(i,l),R2*H(i,2), •.•
R3*H{i,3),R4*H(i,4),RS*H(i,5), ..•
Cl*H(i,6),C2*H(i,7),s);
end
\ start FMCA
M=7;N=2~M;Tn=zeros(M,N);Dr=zeros(M,N);
for k=l:N;for w=l:M;Re(w,k)=k;end;end
for k=l:N
for w=l:M
Re(w+l,k)=floor(Re(w,k)/2);
Dr(w,k)=Re(w,k)-2*Re(w+l,k);
if Dr(w,k)2•0
Tn(w,k)=l+T(l,w);
else
Tn(w,k)=l+T(2,w);
end
end
end
for i=l:Lit
s=2*pi*F(i)*j;
for k=l:N
vm(k,i)=G3(Rl*Tn(l,k),R2*Tn(2,k), ••.
R3*Tn(3,k),R4*Tn(4,k),RS*Tn(5,k), ...
Cl*Tn(6,k),C2*Tn(7,k),s);
end
AppendiX 131
end
Vmax=max(vml ;Vpk=max(Vmax);
%
subplot(l,l,ll
m=plot(F,VH, 'k' ,F,Vo, 'r' ,F,Vmax, 'g');
set(m,'LineWidth',2)
grid on
axis([BF LF 0 30))
xlabel('Freq (Hz) ','PontSize',8);
ylabel('Volts','FontSize',8)
title('Fig 41. EVA & FMCA','FontSize',8)
function y = G3(Rl,R2,R3,R4,R5,Cl,C2,s)
% fen for sallen & key transfer function
Nl=(l+R5/R4)/(Rl*Cl);
Dl=(l/Rl-R5/(R2*R4)+2/R3)/Cl;
D0= (1/Rl+l/R2)/(R3*Cl*C2);
y=abs(Nl*s/(sA2+Dl*s+D0));
for W=l:Nc
if mc:==l
Tn(k,w) = ( (T(2,w) -T(l,wl l /6) * ...
(randn+3l+T(l,w)+l;
else
Tn(k,w)=(T(2,w)-T(l,w) )* •••
rand+T(l,wl +1;
end
end
end
Lit=(LF-BF)/DF+l;
F•linspace(BF,LF,Lit);
for ial:Lit
s=2*pi*F(i)•j;
Vo(i)=B6(Rl,R2,R3,R4,R5,Cl,C2,s);
for k=l:N
D=B6(Rl*Tn(k,l),R2*Tn(k,2), . .•
R3*Tn(k,3) ,R4*Tn(k,4) I •••
R5*Tn(k,5),Cl*Tn(k,6), •••
C2*Tn(k,7),s);
if mc•=l
Vln(k,il=D;
else
Vn(k,i)=D;
end
end
end
end
Vlnaxl=max(VIn) ;Vlnax2-max(Vnl;
'
subplot(2,l,ll
H•plot(P,Vo, 'k');
sl='Fig 42. Sallen & Key';
s2•'BPF Nominal Output';
s3=strcat(sl,s2);
title(s3)
grid on
ylabel ( 'Volts ' l
'
subplot(2,1,2);
h=plot(P,Vlnaxl,'k',F,Vmax2, 'b');
xlabel('Freq(Hz) ');
Appendix 133
ylabel ('Volts •)
title('Fig 43. Sallen & Key BPF MCA')
text(420,120,('N = •,num2str(N)]);
function y = B6(Rl,R2,R3,R4,RS,Cl,C2,s)
\ matrix fen for Sallen & Key BPF
Ao=le6;
A=zeros(4);
A=(l/Rl+l/R2+s*(Cl+C2) -s*C2 0 -l/R2; ••.
-s*C2 1/R3+s*C2 0 0; .. .
0 0 l/R4+l/RS -1/RS; .. .
0 -Ao Ao l];
B={l/Rl;O;O;O];
C=A\B;y=abs(C(4));
if nc==l;Nm=lOO;else;Nm=lOOO;end
for p=l:Nm
for w=l:M
Tn(w,p)=(T(2,w)-T(l,w))*rand+T(l,w)+l;
end
end
for i=l : Lit
s=2*pi*F(i)*j;
if nc=sl
Vo(i)=B3(Rl,R2,Ra,Rb,Cl,C2,s);
for k=l:Nf
Vf(k,i)=BJ(Rl*Tf(l,k),R2*Tf(2,k), • . .
Ra*Tf(J,k),Rb*Tf(4,k), ..•
Cl*Tf(S,k),C2*Tf(6,k),s);
end
end
for p=l:Nm
Vm(p,i)=BJ(Rl*Tn(l,p),R2*Tn(2,p), ..•
Ra*Tn(J,p) ,Rb*Tn(4,p), ••.
Cl*Tn(S,p),C2*Tn(6,p),s);
end
end
if nc=:l
Vmaxl=max(Ym);Vmax3=max(Vf);
Na=Nm;clear vm;
else
Vmax2=max(vm);Nb=Nm;
end
end
'
subplot(2,1,1)
h=plot(F,VmaxJ, 'k.:',F,Vo, ' k--',F,Vmaxl, 'k');
set(h, 'LineWidth',2);grid on
axis ([BF LF 0 1400])
ylabel ('Volts' I
title('Fig 44. Delyiannis BPF')
text(410,700, ['N = ',num2str(Na)],'FontSize',8);
vpkl=max(Vmaxl);vpkJ=max(Ymax3);
'
subplot(2,1,2l
h=plot(F,Vmax3, 'k.:',F,Vo, 'k--',F,Vmax2, 'k');
set(h, 'LineWidth',2);grid on
Appendix 135
function y = B3(Rl,R2,Ra,Rb,Cl,C2,s)
% fen for Delyiannis BPF
Nl=(Ra+Rb)/(Rl*C2*Rb);
Dl=(l/Cl+l/C2)/R2-Ra/{Rl*C2*Rb);
DO=l/{Rl*R2*Cl*C2);
y=abs(Nl*s/(sA2+Dl*s+D0));
for p=1:Nm
for w=1:M
Tn(w,p)=(T(2,w)-T(1,w))*rand+T(1,w)+1;
end
end
for i=l:Lit
s=2*pi*F(i)*j;
if nc=:or:1
Vo(i)=T2(R1,R3,R5,C2,C4,C6,s);
for k=1:Nf
Vf(k,i)=T2(R1*Tf(1,k),R3*Tf(3,k), ••.
R5*Tf(5,k),C2*Tf(2,k),C4*Tf(4,k), •..
C6*Tf(6,k),s);
end
end
for p=1:Nm
Vm(p,i)=T2(Rl*Tn(1,p),R3*Tn(3,p), ••.
R5*Tn(5,p),C2*Tn(2,p),C4*Tn(4,p), .••
C6*Tn{6,p), s);
end
end
if nc:o=1
Vmaxl=max(Vm) ;Vmax3=max(Vf);
N1=Nm; clear Vm;
else
Vmax2=max!Vm);N2=Nm;
end
end
t
subplot(2,1,1)
b:or:plot(P,Vmax3,'k.:',F,Vo,'k--',F,Vmaxl,'k');
set(b,'LineWidth',2);grid on
taxis ([BF LF 0 15])
ylabel ( 'dBV')
title('Fig 46. Twin-T FMCA/MCA')
text(45,-35,('N = •,num2str(N1)],'FontSize',8);
t
subplot(2,1,2)
b=plot(F,Vmax3,'k.:',F,Vo,'k--',F,Vmax2,'k');
set(h,'LineWidth',2);grid on
taxis ((BF LF 0 15])
xlabel ( 'Preq(Hz) •) ;ylabel ( 'dBV')
Appendix 137
function y = T2(Rl,R3,R5,C2,C4,C6,s)
% fen for twin-T passive notch filter
A=zeros(3);
A(l,l)=l/RS+s*(C4+C6);A(l,3)=-s•C6;
A(2,2)=1/Rl+l/R3+s*C2;A(2,3)=-1/R3;
A(3,l)=A(1,3);A(3,2)=A(2,3);
A(3,3)=1/R3+s*C6;
B=[s*C4;1/R1;0];
C=A\B;y=20*log10(abs(C(3)));
for nc=l:2
if nc=•l;Nm=lOO;else;Nm=lOOO;end
for p=l:Nm
for w=l:M
Tn(w,p)=(T(2,w)-T(l,w))•rand+T(l,w)+l;
end
end
for i•l:Lit
8"'2•pi*F(i)•j;
if nc==l
Vo(i)=B5(Rl,R2,Rin,Rq,Cl,C2,s);
for lt=l:Nf
Vf(lt,i)=B5(Rl*Tf(l,lt),R2*Tf(2,lt), • • •
Rin*Tf(3,lt),Rq*Tf(4,lt), •••
Cl*Tf(5,1t),C2*Tf(6,lt),s);
end
end
for p=l:Nm
Vm(p,i)=B5(Rl*Tn(l,p),R2*Tn(2,p), •••
Rin*Tn(3,p),Rq*Tn(4,p), •••
Cl*Tn(5,p),C2*Tn(6,p),s);
end
end
if nc==l
Vlllaxl=max(Vm) ,vmax3=max(Vf);
Na=Nm;clear Vm;
else
Vlllax2=max(Vm) ;Nb=Nm;
end
end
'
aubplot(2,1,1)
b=plot(P,VIIIax3, 'k.:',F,Vo,'k--',P,VIIIaxl,'lt');
set(h,'LineWidth',2);grid on
axis ([BF LF 0 15])
ylabel ('Volts')
title('Pig 48. LTC1562 BPF')
text(8200,12,['N = ',num2str(Na)],'FontSize',8);
vPitl=max(VIIIaxl);vPit3=max(VIIIax3);
'
subplot(2,1,2)
h=plot(P,VIIIax3, 'k.:',F,Vo, 'k--',F,Vmax2,'k');
Appendix 139
set(h, 'LineWidth',2);grid on
axis ((BF LF 0 15])
xlabel('Freq(Hz) ');ylabel('Volts')
title('Fig 49. LTC1562 BPF')
text(8200,12,('N = ',num2str(Nb)],'FontSize',8);
Vpk2=max (Vmax2) ;
function y = B5(Rl,R2,Rin,Rq,Cl,C2,s)
\ fen for LTC1562 BPF
Nl=-l/(Rin*C2);Dl=l/(Rq*C2);
DO=l/(Rl*R2*Cl*C2);
y=abs(Nl*s/(sA2+Dl*s+D0));
Nm=lOO;
else
Nm=lOOO;
end
for p=l:Nm
for w=l:M
Tn(w,p)=(T(2,w)-T(l,w))*rand+T(l,wl+l;
end
end
for i=l:Lit
s=2*pi*F(i)*j;
if nc==l
D=G4(Rl,R2,R3,R4,Cl,C2,Ao,s);
Vo(i)=D;
end
for k=l:Nf
D=G4(Rl*Tf(l,k),R2*Tf(2,k), ..•
R3*Tf(3,k),R4*Tf(4,k),Cl*Tf(S,k), ...
C2*Tf(6,k),Ao,s);
Vf(k,i)=D;
end
for p=l:Nm
D=G4(Rl*Tn(l,p),R2*Tn(2,p), • • •
R3*Tn(3,p),R4*Tn(4,p),Cl*Tn(S,p), .•.
C2*Tn(6,p),Ao,s);
Vln(p,i)=D;
end
end
if nc==l
Vmaxl=max(Vln) ;Vmax3=max(Vf);
Nl=Nm;clear VIII;
else
Vmax2=max(Vln);N2=Nm;
end
end
'
subplot(2,1,1)
h=plot(F,Vmax3, 'k.:',F,Vo, 'k--',F,Vmaxl, 'k');
set(h,'LineWidth',2);grid on
axis ((BF LF 70 190])
ylabel('Phase Angle (deg)')
title("Fig SO. MFB All-pass')
Appendix 141
YT=linspace(70,190,7);
set (gca, 'ytick', YT);
text(460,100,['N = •,num2str(Nl)],'FontSize',8);
vpkl=max(vm&xl);vpk3=max(vm&x3);
'
subplot(2,1,2)
h=plot(F,Vmax3,'k.:',F,Vo,'k--',F,Vmax2,'k');
set(h, 'LineWidth',2);grid on
axis ([BF LF 70 190])
xlabel('Freq(Hz) ');
ylabel('Phase Angle (deg)')
title('Fig 51. MFB All-pass')
YTzlinspace(70,190,7);
set (gca, •ytick', YTJ;
text(460,100,['N = •,num2str(N2)],'Fontsize',8);
VPk2=max (vm&x2 J ;
function y = G4(Rl,R2,R3,R4,Cl,C2,Ao,s)
tall-pass circuit function
A=zeros(4);
A(l,l)=l/Rl+s*Cl+s*C2;
A(l,2)=-s*Cl;A(l,4)=-s*C2;
A(2,1)=A(1,2);A(2,2)=1/R2+s*Cl;
A(2,4)=-l/R2;
A(3,3)=1/R3+1/R4;A(4,2)=-Ao;
A(4,3)=Ao;A(4,4)=1;
B=[l/Rl;O;l/R3;0];
C=A\B;y=(l80/pi)*angle(C(4));
Nl=Nm;clear Vm;
else
Vmax2=max(Vm);N2=Nm;
end
end
'
subplot(2,1,1)
h=plot(F,Vmax3, 'k.:',F,Vo,'k--',F,Vmaxl, 'k');
set(h,'LineWidth',2);grid on
axis ( [BF LF 0 1.2))
ylabel ('Volts')
title('Pig 52. MFlO SCF BPF')
YT=linspace(O,l.2,7);
set (gca, •ytick', YT);
text(560,0.5, ['N = ',num2str(Nl)),'FontSize',8);
VPkl=max(Vmaxl);VPk3=max(Vmax3);
'
subplot(2,1,2)
h=plot(F,Vmax3,'k.:',F,Vo, 'k--',F,Vmax2, 'k');
set(h, 'LineWidth',2);grid on
axis ([BF LF 0 1.2))
xlabel ( 'Freq(Hz) ') ;ylabel ('Volts')
title('Fig 53. MFlO SCF BPF')
YT=linspace(0,1.2,7);
set (gca, •ytick', YT);
text(560,0.5,['N = •,num2str(Nl)), 'FontSize',8);
VPk2=max (vmax2) ;
function y = SCF(Rl,R2,R3,R4,wc,s)
'i function for SCF
Nl=wc*R2/Rl;Dl=wc*R2/R3;DO=wcA2*R2/R4;
y=abs(Nl*s/(sA2+Dl*s+D0));
R5=4.8e3;C1=47e-9;C2=Cl;C3=Cl;
BF=40;LF=80;DF=O.S;Lit=(LF-BF)/DF+l;
F=linspace(BF, LF, Lit);
Tr=O.Ol;Tc=O.l;
T=[-Tr -Tr -Tr -Tr -Tr -Tc -Tc -Tc; .••
Tr Tr Tr Tr Tr Tc Tc Tel;
M=8;Nf=2"M;
Tf=zeros(M,Nf);A=zeros(6);
for k=l:Nf;for w=l:M;Re(w,kl~k;end;end
for k=l:Nf
for w=l:M
Re(w+l,k)~floor(Re(w,k)/2);
Dr(w,k)=Re(w,k)-2*Re(w+l,k);
if or(w,k)~ao
Tf(w,kl=l+T(l,w);
else
Tf(w,k)=l+T(2,w);
end
end
end
rand('state',sum(lOO*clock));
for nc=1:2
if nc==l;Nm=lOO;else;Nm=lOOO;end
for p•l:Nm
for w=l:M
Tn(w,p) = ( (T(2,w) -T(l,w)) /6) * •.•
((3*(2*rand-1))+3)+T(l,w)+l;
end
end
for io:l:Lit
s•2*pi*F(i)*j;
if nc=•l
Vo(i)=G5(Rl,R2,R3,R4,RS,Cl,C2,C3,s);
end
for k=l:Nf
Vf(k,i)=GS(Rl*Tf(l,k),R2*Tf(2,k), . • •
R3*Tf(3,k),R4*Tf(4,k),R5*Tf(S,k), ••.
Cl*Tf(6,k),C2*Tf(7,k),C3*Tf(8,k),s);
end
for p=l:Nm
vm(p,i)=GS(Rl*Tn(l,p),R2*Tn(2,p), .•.
R3*Tn(3,p),R4*Tn(4,p),RS*Tn(S,p), .• •
Appendix 145
Cl*Tn(6,p),C2*Tn(7,p),C3*Tn(8,p),s);
end
end
if nc==l
Vmaxl=max(Vm) ;V!nax3=max(Vfl;
Nl=Nm; clear Vlll;
else
Vmax2=max(Vlli);N2=Nm;
end
end
'
subplot(2,1,1)
h=plot(F,Vmax3, 'k.: ',F,Vo, 'k--',F,Vmaxl, 'k');
set(h, 'LineWidth',2);grid on
axis ([BF LF -60 20])
ylabel ( •dBV. )
title('Fig 54. Buffered Notch')
text(46,-30,['N = •,num2str(Nl)],'FontSize',8l;
vpkl=max(Vlllaxll;VPk3=max(Vlllax3);
'
subplot(2,1,2l
h=plot(F,Vmax3, 'k.:',F,Vo, 'k--',F,Vmax2, 'k');
set(h,'LineWidth ' ,2);grid on
axis ([BF LF - 60 20])
xlabel ( 'Preq(Hz) •) ;ylabel ( 'dBV')
title('Pig 55 . Buffered Notch')
text(46,-30,['N = •,num2str(N2)],'FontSize',8);
VPk2 =max (Vlllax2 l ;
function y = G5(Rl,R2,R3,R4,R5,Cl,C2,C3,s)
% buffered 60Hz notch filter
A=zeros(6);
A(l,l)=l/Rl+s*(Cl+C2);
A(l,2)=-s*C2;A(l,5)=-l/Rl;
A(2,l)=A(l,2)IA(2,2)=1/R2+s*(C2+C3);
A(2,3)=-s*C3;A(2,5)=-1/R2;
A(3,2)=A(2,3);A(3,3):1/R3+s*C3;
A(4,4)=1;A(4,5)=-l;
A(5,5)=1/R4+1/R5;A(5,6)=-l/R4;
A(6,3)=-l;A(6,6)=1;
B=[s*Cl;O;l/R3;0;0;0];C=A\B;
yz20*log10(abs(C(6)));
146 Tolerance Analysis of Electronic Circuits
'
subplot(21111l
h=plot(PISR21'k'IPISR31 'r'IFISCll'g' 1FISC2 1 'b');
set(h 1 'LineWidth' 11);grid on;
axis([BF LF -15 15))
ylabel('%/%');
title('Fig 56. Sensitivities of R21R31C11C2 MFB BPF')
'
subplot(21112l
b=plot(FISR21 'k'1F1SRJ1 'r'1F1SC11 'g' 1F 1SC2 1 'b');
set(bl 'LineWidth'~l);grid on;
axis([500 501 -1.5 1.5))
xlabel('Freq(Hz) ');ylabel('%/%');
title('Fig 57. Near fo = 500.6 Hz')
s1='At fo=500.6 1 high to ';
s2='low order is:';
s3=strcat(sl~s2);
text(500.1~-0.5~s3~'PontSize'~8l
text (500 .11 -0.81 'R31CliR21C2 • 'Fontsize • 8)
I I
References
1. Introduction to Random Signal Analysis and Kalman Filter-
ing, R.G. Brown, Wiley, 1983, p.44.
2. Principles ofActive Network Synthesis and Design, G. Dary-
anani, Wiley, 1976.
3. Tolerance Design of Electronic Cin:uits, R. Spence and R.S.
Soin, Addison-Wesley, 1988. (Emphasis on theoretical
aspects of MCA and circuit design to meet specifications
with maximum manufacturing yield. Tenninology: EVA=
"Vertex Analysis;" RSS = "Method of Moments.")
4. Tolerance Design, C.M. Creveling, Addison-Wesley, 1997.
(Mechanical and economic aspects of tolerance analysis.)
S. New Tolerance Analysis Methods, R. Boyd, RF Design '97
Conference and Expo, Conference Papers, 1997, p.75 and
p.307. (Seminal paper.)
6. Will Your Design Keep on Working? D. Divekar and R. Apte,
Test & Measurement World, 3/89, p.81. (Excellent treatment
of sensitivity.)
7. Spectral Analysis and its Applications, G.M. Jenkins and
D.G. Watts, Holden-Day, 1968, p.76. (Definition of variance
of a non-linear function; confidence intervals.)
8. Surveying, F.H. Moffitt and H. Bouchard, 6th edition, Harper
& Row,1975, pp 166-168. (Derivation ofRSS formula from
total differential.)
9. An Introduction to Error Analysis, 2nd edition, J.R. Taylor,
University Science Books, 1997. (Subtitle: The Study of
Uncertainties in Physical Measurements.)
10. MIL-SID-785B, Task 206, Electronic Parts/Circuits Toler-
ance Analysis.
II. A Handbook ofActive Filters, D.E. Johnson, et al, Prentice-
Hall, 1980.
12. Statistical Tolerancing, D.D. Brady and DJ. Odorizzi, Elec-
tronic Design. 411n8, p.l34.
147