• No se han encontrado resultados

CYB5R3-overexpressing mice submitted to different dietary fats

Resistors, capacitors and inductors all oppose the flow of current, i, and this property is termed impedance, Z. Using Ohm’s law, in general we can state that the voltage v across the component is a product of its impedance and the current, that is,

v = iZ. (4.1)

Now the impedance of a resistor, R, is independent of frequency, and so its resistance does not change regardless of whether the current is direct or alternating. This being the case, the impedance is purely real, that is, it is given the value

Zr= R. (4.2)

Since it is real, the current flowing through it is in phase with the voltage across it, as shown in Figure 4.1(a). In contrast, the impedances of capacitors and inductors are frequency dependent, and are purely imaginary. Taking the case of the capacitor, C,

R

Figure 4.1 The resistor, capacitor and inductor, together with their voltage/current phase relationships

first, for any given alternating sinusoidal current, the voltage across it lags the current flowing through it by 90, or π/2 rad. Moreover, the impedance is inversely propor-tional to the frequency; this makes intuitive sense, since a DC voltage will simply see a plate gap, that is, an infinite impedance. Now multiplying a value by−j is equivalent to delaying by 90, as we showed in Section 2.3. Hence we can state that

Zc= −j ωC = 1

jωC, (4.3)

where ω = 2πf . In contrast, the impedance of the inductor, L, is proportional to frequency, and the voltage across it leads the current by 90. Following the same line of reasoning therefore, we find that its impedance is given by

Zl= jωL. (4.4)

Any circuit which comprises a combination of these three components will possess an impedance with real and imaginary terms, and therefore both the phase and the magnitude of its output (sinusoid) signal will depend on the frequency of the input sinusoid. It is perhaps worth mentioning at this stage the fact that in most practical cases, inputs to electrical circuits do not consist of simple sinusoids. However, the analysis is still valid, because by the law of superposition and the principle of Fourier series, any complex waveform can be represented as a series of sinusoids of different frequency, magnitude and phase.

Before proceeding to an analysis of some simple filter networks, take a look at Figure 4.2. This shows two simple circuits which appear many times and in various guises in electrical systems, and it is worth identifying their input/output properties here. The circuit shown in Figure 4.2(a) is called a potential divider, and the ratio of the output voltage over the input is given by the celebrated formula

v2

v1 = Z1

Z1+ Z2

. (4.5)

v1

v2 Z1

Z2

v1

Z1 Z2

a b

Figure 4.2 (a) The potential divider using impedances in series and (b) two impedances in parallel

v1()

R

1/jC

v2()

Figure 4.3 A simple low-pass RC filter

In general, the total impedance of a series circuit comprising n components is found by simply summing the individual impedances, that is,

ZT= Z1+ Z2+ · · · + Zn. (4.6)

The total impedance of the parallel circuit comprising n components is given by:

ZT=

 1 Z1 + 1

Z2+ · · · + 1 Zn

−1

. (4.7)

For the circuit shown in Figure 4.2(b), Equation (4.7) is equivalent to ZT= Z1Z2

Z1+ Z2

. (4.8)

4.2.1 Analysis of a first order low-pass RC filter

Consider the simple low pass filter shown in Figure 4.3. This is a first order RC type.

The ratio of the output to the input is given by the potential divider equation, that is, Equation (4.5), so in this case we have, in complex terms

v2(ω)

v1(ω) = 1/jωC

R + (1/jωC) = 1

1+ jωRC. (4.9)

Note that we are now expressing the input and output voltages as functions of frequency. To obtain its magnitude and phase response for specific component values and at a given frequency, we simply insert them into Equation (4.9) and evaluate accordingly. For example, if we choose a resistance of 1 k , a capacitance of 1 μF and a frequency of 400 Hz, we get

v2(ω)

v1(ω) = 1

1+ jωRC = 1

1+ j(2π × 400 × 103× 10−6)

= 0.1367 − j0.3435 = 0.37∠ − 1.1921. (4.10)

Hence the output of this filter at 400 Hz is 0.37 that of the input, with a phase lag of 1.1921 rad. For a simple low-pass RC filter, the frequency at which the magnitude of the output falls to 0.707 of the magnitude of the input, is given by

fc= 1

2πRC. (4.11)

This is also variously known as the−3 dB point, the 1/

2 point or the cut-off point.

Now this analysis is all very well as far as it goes, but what if we wanted to obtain the frequency response of this filter, in terms of both magnitude and phase, for a wide range of frequencies? We could calculate these manually, simply by inserting different values of ω into Equation (4.9). This would be extremely laborious and increasingly error-prone as we tired of the task. It would be much better to write a computer program to calculate the values automatically; all that is necessary is the equation and a loop-structure to specify the frequency range over which the response is to be computed. Such a program is provided on the CD that accompanies this book, located in the folder Applications for Chapter 4\Filter Program\, under the title filter.exe.

The main project file is called filter.dpr. This program allows the user to select from a variety of filter types, enter the component values and specify the frequency range over which the response is to be plotted. Figure 4.4 shows a screenshot of the program’s user interface.

The program can display the frequency response in a variety of ways, including linear magnitude, decibel (dB) scale, phase and so on. It can also calculate a filter’s impulse response, something that we will look at in a little more detail later on. Finally, this software has the facility to export the frequency response data as a text file, so a graphing program or spreadsheet can be employed to plot various combinations of the magnitude and phase response. Figure 4.5, for example, shows these two parameters plotted together, again using the same first order filter. One of the most obvious disadvantages of this kind of passive network is its poor cut-off response;

the transition zone is very gradual, so any filter of this kind intended to remove noise will in all likelihood attenuate some of the signal bandwidth.

This figure also verifies that the phase response at 0 Hz (DC) is 0, tending towards

−90as the frequency approaches infinity. A brief inspection of Equation (4.9) shows why this is the case.

Figure 4.4 Screenshot of the program filter.exe

Frequency, Hz

Magnitude

Phase –1

– 0.5 0 0.5

0 200 400 600 800 1000 1200 1400 1600

Phase (radians) and magnitude

–1.5 1

Figure 4.5 Magnitude/phase plot of simple first order filter

4.2.2 A two-stage buffered first order low-pass filter

It is tempting to think that the transition-zone response of a first order filter can be improved by cascading a couple of them together, with a unity-gain buffer positioned

R

R v1()

v2() 1/jC

1/jC

Figure 4.6 A two-stage cascaded first order low-pass filter with a unity-gain buffer

between them to prevent the impedance of one stage loading the other (the buffer, normally constructed as a unity gain op-amp follower, has virtually infinite input impedance and very low output impedance). The cascaded circuit arrangement is shown in Figure 4.6.

Unfortunately, the frequency response is not really improved – all that happens is the magnitude response is squared, and the phase angle is doubled, since the response is now given by:

v2(ω) v1(ω) =

1

1+ jωRC

1

1+ jωRC

= 1

1− (ωRC)2+ j2ωRC. (4.12)

We can prove this by using filter.exe to plot this filter’s frequency response, which is shown in Figure 4.7. Once again, the program has calculated the response by implementing Equation (4.12) according to the component values and sweep range specified by the user.

4.2.3 A non-buffered, two-stage first order filter

Wat happens if we remove the buffer and simply cascade the two first order stages?

This circuit arrangement is shown in Figure 4.8.

The response is still not improved in any meaningful way, but the algebra is made a little more complicated because of the impedance loading effect. In order to calculate the complex impedance, we first need to obtain the expression for the voltage at node N. This is a junction point of a potential divider comprising R from the top and Z from the bottom. In turn, Z is obtained from the parallel combination of (a) a capacitor and (b) a capacitor and resistor in series. So the voltage at node N

Frequency, Hz

Phase (radians) and magnitude

–3 –2.5 –2 –1.5 –1 – 0.5 0 0.5 1

0 200 400 600 800 1000 1200 1400 1600

Phase Magnitude

Figure 4.7 Frequency response of buffered, cascaded first order filter shown in Figure 4.6

R

R N

Z v1()

v2() 1/jC

1/jC

Figure 4.8 A non-buffered two-stage first order low-pass filter is given by

vN(ω) v1(ω) = Z

Z + R, (4.13)

where Z is obtained in relation to Equation (4.7), that is, Z =



jωC + jωC

jωRC + 1

−1

. (4.14)

The voltage at node N can therefore be seen as the input to the second RC stage, so the entire complex impedance expression becomes:

v2(ω) v1(ω) = Z

Z + R× 1

jωRC + 1. (4.15)

Magnitude

Phase

– 2.75 – 2.25 – 1.75 – 1.25 – 0.75 – 0.25 0.25

Phase (radians) and magnitude

– 3.25 0.75

200 400 600 800 1000 1200 1400

Frequency, Hz

0 1600

Figure 4.9 Frequency response of non-buffered, cascaded first order filter shown in Figure 4.8

As Figure 4.9 shows, although the stop-band performance is similar to that of the two-stage buffered filter, the zone around the−3 dB point, sometimes referred to as the knee of the filter, is no sharper.

Before we move on to some rather more interesting circuits, it is worth mentioning a couple of points about the designs we have covered thus far. First, we could have transposed the positions of the resistor and capacitor in the basic arrangement to produce a first order high-pass filter. In this case, the magnitude of the response would be zero at DC, tending towards unity as the frequency tended towards infinity.

Second, it is clear that to design filters with better transition zone performance, we need to employ some new component, typically either an inductor or an active gain stage element. We will leave active filters for another time, and concentrate now on the tuning effect that occurs when we introduce an inductive component into the network.

4.2.4 A tuned LCR band pass filter

Take a look at the circuit shown in Figure 4.10, which shows a second order tuned LCR filter. Once again, the output can be obtained from the potential divider equation, that is,

v2(ω)

v1(ω) = R

jωL + (1/jωC) + R. (4.16)

If we multiply both the numerator and the denominator by 1/jωC, we obtain for the complex impedance:

v2(ω)

v1(ω) = jωRC

1− ω2LC + jωRC. (4.17)

R v1()

jL

1/jC

v2()

Figure 4.10 A tuned LCR filter

– 2 – 1.5 –1 – 0.5

0 0.5 1 1.5 2

Frequency, Hz

Phase (radians) and magnitude Phase

Magnitude

0 200 400 600 800 1000 1200 1400 1600

Figure 4.11 Frequency response of the tuned LCR circuit shown in Figure 4.10

Figure 4.11 shows the output of the program filter.exe, when used to calculate the frequency response of a tuned LCR filter, in which the component values were L = 0.1 H, C = 1 μF and R = 10 . The first thing that is apparent from these traces is that the filter has a very sharp resonance, the frequency of which is given by

f0= 1

LC. (4.18)

In addition, at zero frequency the phase of the output is advanced over the input by 1.571 rad, or 180, but retarded by the same amount for very high frequencies.

At resonance however, the phase shift is zero. All of these conditions are readily understandable with reference to Equation (4.17).

Clearly, when ω is zero, the numerator of Equation (4.17) and hence the output must also be zero. At a frequency infinitesimally greater than zero, the phase of the output leads the input by 1.571 rad since the imaginary term of the numerator dominates. At resonance, the ω2LC term in the denominator evaluates to−1, giving a gain of 1 and no phase change. At very high frequencies, the gain once more tends to zero but with an output lagging the input by 1.571 rad since the denominator terms now dominate the expression. As we shall see, the behaviour of this circuit may be described precisely using a second order differential equation of the kind discussed in Section 2.5.2; furthermore, its auxiliary equation provides an insight into the degree of tuning built into the system. For a highly tuned filter, the peak is very sharp and the circuit is therefore said to have a high Q (meaning quality) factor, defined by

Q = f0

f, (4.19)

where f0 is the centre (peak frequency) and f represents the filter’s bandwidth between the−3 dB limits. The tuned LCR filter is not only of interest for its own sake, but because it draws together many related ideas pivotal to the subject of DSP.

For example, when we design high-order recursive filters, we normally cascade them as second order sections; one of the reasons this is done is to avoid the risk of instability, a characteristic that is intimately linked to how highly tuned the system is. What’s more, by expressing the differential equation as a difference equation, we can appreciate how the recursive equations of digital filters are constructed.

4.2.5 Software for complex impedance analysis

So far, we have obtained complex impedance expressions for some basic filter types and seen how these equations can be employed to provide the frequency responses, both in terms of magnitude and phase. Now, we are going to look at some code fragments of filter.exe to see how it performs the necessary calculations. The first and most important observation in all of this is that many computer languages cannot explicitly handle complex numbers; therefore, we need to write some simple routines to manipulate the real and imaginary terms according to the rules governing complex algebra, described in Section 2.3. Listing 4.1 shows four procedures present in the program’s main form, filter_form, which perform addition, multiplication, division and inversion of complex numbers. These procedures are called c_add, c_multiply, c_divide and c_invert, respectively. Taking addition first, we recall that the real and imaginary terms of a complex number are added separately.

Therefore, c_add has six parameters in its argument list – the real and imaginary terms of the two (input) numbers to be summed, that is (r1, i1) and (r2, i2), and the resulting output, (r3, i3). The internal workings of this procedure are straightforward. In a similar fashion, c_multiply and c_divide have the same six parameters in their argument lists. The procedure c_multiply achieves the complex multiplication by assuming that all quantities are real before applying the identity j2 = −1. The procedure c_divide obtains the complex division by

multiplying both the numerator and the denominator by the conjugate of the denomi-nator. Finally, c_invert is a variant of c_divide. However, it only requires four parameters in the list, the input and output complex number pair.

procedure c_add(r1,i1,r2,i2:real;var r3,i3: real);

begin

r3:=r1+r2;

i3:=i1+i2;

end;

procedure c_multiply(r1,i1,r2,i2:real;var r3,i3: real);

begin

r3:=r1*r2-i1*i2;

i3:=i1*r2+i2*r1;

end;

procedure c_divide(r1,i1,r2,i2:real;var r3,i3: real);

var

denom: real;

begin

denom:=r2*r2+i2*i2;

r3:=(r1*r2+i1*i2)/denom;

i3:=(i1*r2-i2*r1)/denom;

end;

procedure c_invert(r1,i1:real;var r2,i2: real);

var

denom: real;

begin

if (r1=0) and (i1=0) then begin

r2:=0;

i2:=0;

exit;

end;

denom:=r1*r1+i1*i1;

r2:=r1/denom;

i2:=-i1/denom;

end;

Listing 4.1

Some or all of these procedures are invoked whenever the program needs to obtain the output frequency response of a selected filter at a given frequency. Let us find out how this works for obtaining the frequency response of the circuit we have just looked at, the LCR filter. Listing 4.2 shows the important code.

for n:=0 to 512 do begin

frq:=2*pi*fnc*n;

c_divide(0,frq*res*cap,(1-frq*frq*ind*cap), frq*res*cap,freq_re[n],freq_im[n]);

freq_mag[n]:=sqrt(sqr(freq_re[n])+sqr(freq_im[n]));

end;

Listing 4.2

As the first line of Listing 4.2 shows, the program always calculates 512 harmonics (for reasons connected with an inverse Fourier transform that we will discuss later), so the frequency interval depends on the range over which the response is to be calculated. For example, if the user specifies a range extending to 1500 Hz, then the program would set the frequency interval variable, fnc, to 2.93. Within the for...nextloop, Equation (4.17) is evaluated for each harmonic interval within the range. The equation in question represents a complex division, so on the fourth line of the listing shown, the procedure c_divide is invoked. The numerator has zero for the real term, which is entered as the first parameter of the argument list. The imaginary term is given by and ωRC; here, ω is held in the variable frq (third line), and R and C are held in the variables res and cap, respectively. These component values are obtained from the respective edit boxes present on the user interface. So frq*res*capbecomes the second input parameter of the argument list, that is, the imaginary term of the numerator. The real term of the denominator is given by (1−ω2LC), and the imaginary term again by ωRC. The complex output is written into the arrays freq _re and freq _im. The output values are stored in this manner because they are used not only by the graphical plotting routines, but also by an inverse Fourier transform to obtain the filter’s impulse response.

The frequency response of the remaining RC filter types are obtained in exactly the same way, that is, each respective complex impedance expression is evaluated over a range of frequencies. An important lesson in all of this is again, modularity.

Once the routines for complex number arithmetic have been formulated, it is a simple matter to derive complex impedance expressions for any manner of circuit, no matter how sophisticated.