2011年12月30日 星期五

轉移函數和波德圖

轉移函數和波德圖 (Transfer Function & bode plot)

Pole Zero Java Applet

http://web.mit.edu/6.302/www/pz/    (MIT web site!!! good !!!推荐) 

波德圖手繪的規則

波德圖的前提就是可以可以處理以下型式函數的對數值:

上述函數的對數值可以轉換為極點及零點對數的和:

在繪製波德相位圖時直接使用了上述的概念。增益圖的繪製時則是以此概念為基礎,因為每個極點或零點其增益的對數均從0開始,而且其漸近線只有一個轉折點,因此繪製時可以再作簡化。

 直線近似的增益圖

波德圖增益分貝值一般都利用20log 10(X)的公式。考慮以下的轉換函數:

其中xnyn是常數,s = jω, an,bn > 0,而H是轉換函數。

  • 在每個對應ω = xn(零點)的位置,將直線的斜率增加/十倍頻[註解 1]
  • 在每個對應ω = yn(極點)的位置,將直線的斜率減少/十倍頻。
  • 圖在起始點時的增益值,可以依照圖中的角頻率下限,計算其對應的|H(jω)|。
  • 圖在起始點時的斜率則依照有多少零點及極點低於角頻率下限,再依上述二個方式計算斜率,若所有點及極點均高於角頻率下限,起始點時的斜率為零。

在處理無法分解的二次多項式時,多半可以用的方式近似。

 修正後的增益圖

直線近似的增益圖可以用以下方式修正:

  • 針對每個零點,在直線上方的位置增加一點。
  • 針對每個極點,在直線下方的位置增加一點。
  • 以原來的直線為漸近線繪製平滑曲線,通過上述各點,即為修正後的增益圖。

上述的修正方式只針對實數的極點或零點。若xnyn為複數時,比較好的作法仍是找出無法分解的二次式,計算其在零點(或極點)附近的數值,再依數值決定要在直線上方或下方加點。

 直線近似的相位圖

考慮一個以下型式的傳遞函數:

可以先依每個極點及零點分別繪製相位圖,再將各相位圖相加。相位圖的曲線為以下的反正切函數 − arctan(Im[H(s)] / Re[H(s)])

在繪製相位圖時,針對每個極點及零點:

  • 若A為正數,其對應的相位圖是0度的水平線。
  • 若A為負數,其對應的相位圖是180度的水平線。
  • 對每個穩定的零點ω = xn(其零點滿足 Re(z) < 0,即Re(xn) > 0),低於的部份為相位為0度的水平線,之後的直線斜率為+度/十倍頻,到為止,該點的相位為+度,超過此頻率的部份為相同相位的水平線。
  • 對每個穩定的極點ω = yn(其極點滿足 Re(p) < 0,即Re(yn) > 0),低於的部份為相位為0度的水平線,之後的直線斜率為-度/十倍頻,到為止,該點的相位為-度,超過此頻率的部份為相同相位的水平線。
  • 若是不穩定的零點(或極點),其相位增加或減少的趨勢恰與上述相反。
  • 將所有的相位圖相加,即為傳遞函數的完整相位圖。
極點和穩定度

        電路的穩定 (stable) 下個定義:電路中的所有自然響應隨時間而衰減至零者,又只有電路極點p的實部為負值時,才能使自然響應衰減至零,故電路的穩定,惟有在每個極點的時才存在。

        換句話說,穩定度是需電路的所有極點均在複數平面的左半面


other link :

Bode Plot Java Applet


This applet accepts transfer function coefficients as input, and calculates magnitude and phase response over a range of frequencies. A new version is now available which lets you set the start frequency and choose units for the horizontal axis.

Bode Plot Applet Features

  • Variable number of numerator and denominator coefficients, for analyzing filters of varying order. Coefficients may be separated by spaces or commas.
  • Two or more polynomials of varying order can be multiplied together, for analyzing cascaded filter sections. Enclose each polynomial in parentheses or square brackets.
  • Polynomial coefficients can be pasted from other applications. Complex results can be copied to other applications.
  • Vertical axis scales automatically to put peak gain near the top. Horizontal axis normalized to a center frequency of 1 radian/second.
  • Write once, run anywhere capability allows the applet to run on any platform supported with a Java runtime environment. Can be run over the web, or locally in a browser, appletviewer, or from the command line.
  • Open source is here for you to download. Please remember that only you can determine if this applet is usable in your application, and only you know if you are qualified to make modifications.

Using the Bode Plot Applet

The Bode Plot or Bode Diagram 1 is a convenient way to represent the steady state frequency response of an electronic filter. Here, amplitude response is plotted in blue with logarithmic frequency in the horizontal axis over a 2 decade range, against a logarithmic scale of 5 dB per division in the vertical axis. Phase response is plotted in magenta against a linear scale of π/4 radians, or 45° per division in the vertical axis. Follow these steps to use the applet:
  1. Obtain the transfer function of the filter. This is the ratio of the Laplace transforms of the output signal over the input signal. A design example is given below.
  2. Type or paste the numerator coefficients into the first text field. These can be any mix of integer and real numbers, separated by commas or spaces. Coefficients start with the highest order on the left, and continue to zeroth order on the right. You can leave off leading zero-value coefficients, but must include any zero-value coefficients after the first non-zero one. Negative values are allowed, as would be used in all-pass or phase shift filters.
  3. Type or paste the denominator coefficients into the second text field, formatted the same as the numerator. For practical filters, denominator coefficients should always be non-zero and positive.
  4. Click on the [Calculate Plot] button to see the response with the coefficients you have entered. Modify the coefficients and click on [Calculate Plot] again to see how the response changes.

Design Example

To illustrate how to use the Bode Plot Applet, I've taken an example from Don Lancaster2. The design is an octave-wide fourth order bandpass filter covering the range from 200 Hz to 400 Hz. The filter is implemented as two cascaded second order bandpass filter sections with their center frequencies shifted up and down from the nominal center frequency of 277 Hz by a ratio of 1.35:1. Each of the two sections is a multiple feedback filter built around an opamp as shown in the schematic diagram. Resistor and capacitor values for each section are shown in the table.



BPF R1 R2 C1 C2
First
Section




Second
Section



4.4 kOhms44 kOhms.056 uF.056 uF
2.4 kOhms24 kOhms.056 uF.056 uF

Mr. Lancaster gives the transfer function for each section as:


Plug in the actual values to obtain the transfer function coefficients for each filter section.


Before plotting the frequency response however, we need to normalize the coefficients to a center frequency of 1 radian/second. This is done by multiplying S by (2π fc) wherever it appears3. The nominal center frequency of the finished filter is 277 Hz, so we multiply S by 1740.44.


This finally gives us the coefficients we need to plot the normalized frequency response of the complete filter. Copy these numbers into the applet's Numerator and Denominator fields and click the [Calculate Plot] button to see the result.

First Section Second Section Both Sections
Numerator

Denominator

-2.33184, 0-4.27505, 0(-2.33184, 0)(-4.27505, 0)
1, .466369, .543751, .855013, 1.8276(1, .466369, .54375)(1, .855013, 1.8276)
Bandpass Filter Breadboard Results
To verify the accuracy of the Bode Plot Applet, I gathered a bunch of components and plugged them into my breadboard with a pair of TL082 dual opamps. I used parallel and series combinations to get close to the specified resistance and capacitance values, but was still 5% to 10% off on center frequency for each second order section. I then reduced the values of R1 and put trimmer potentiometers in series. Since the characteristics of each filter section rely in part on the source impedance seen by the section, I made sure to drive each filter section from another TL082 output. To accomplish this, I connected one opamp as a unity gain follower to serve as an input buffer.


Using the trimmers, I set the center frequency of each filter section to its nominal value, 205 Hz in the first section and 375 Hz in the second. You could do this by peaking the amplitude response at the center frequency, but it is much easier to connect the input and output of the filter section you are trimming to the X and Y inputs of an oscilloscope to obtain a Lissajous pattern. Then just trim the filter for exactly 180° phase shift (ellipse closes to a single diagonal line) when driven at the desired center frequency.

After this simple tuneup, I measured the overall amplitude response of the completed filter and plotted the results in MS Excel. The following screen shot from Excel shows the measured points as blue diamonds. For comparison, I pasted the predicted values from the Bode Plot Applet into Excel, shown below in magenta. As you can see, the agreement between predicted gain and actual measured results is almost perfect.


References

  1. C. Phillips and R. Harbor, Feedback Control Systems, 3rd ed. Englewood Cliffs: Prentice-Hall, Inc. 1996.
  2. Don Lancaster, Active Filter Cookbook, 2nd ed. Thatcher: Synergetics Press, 1995.
  3. Kerry Lacanette, Application Note #779, National Semiconductor, 1991.
  4. David Flanagan, Java Examples In a Nutshell, Sebastopol: O'Reilly & Associates, Inc. 1997.
  5. Lawrence Rodrigues, Building Imaging Applications with Java Technology, Boston: Addison-Wesley, 2001.
  6. D. Lyon and H. Rao, Java Digital Signal Processing, New York: Henry Holt and Company, Inc. 1998.
  7. Information about the Java SDK is available at Sun's Java Home Page
  8. The Java SDK for Macintosh is maintained by Apple Computer, Inc.

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。