eDeVry University

ECET345 Signals and Systems

Name of Student

Class Room Activity #9

*Transfer Function Analysis of Continuous Systems in *s* Domain Using MATLAB*

*Objective of the lab experiment:*

The objective of this experiment is to create continuous (*s* domain) transfer functions in MATLAB and explore how they can be manipulated to extract relevant data.

We shall first present an example of how MATLAB is used for *s* (Laplace) domain analysis, and then the student shall be required to perform specified analysis on a given circuit.

*Equipment list:*

· MATLAB version 7.0 or higher

· *Software needed: *Sdomainanalysis.m : This file is available in Doc Sharing. If not, it can be obtained from Professor Ajeet Singh of Devry University, Fremont, CA ([email protected]).

**Theory**

*Brief Explanation of Creating Transfer Functions of Circuits in Laplace Domain*

We shall illustrate such analysis by calculating the TF of a filter.

Aside from resistors, there are two other common analog components that are found in circuits: capacitors and inductors. These are reactive components; that is, they are capable of storing (and giving back) energy, in contrast to resistors, which can only convert electrical energy into heat but cannot store it. The volt ampere relationship of the two reactive components are given by

where *L* is the inductance and *C* is the capacitance. This is in contrast with the resistive case, where v(t) = i(t) R, (Ohm’s law), a linear and simple algebraic relationship without any derivative terms.

If one of these reactive components is located in a circuit, then a differential equation would need to be solved in order to see their output over time. The presence of two reactive components would mean a second-order differential equation; three would mean a third order, and so on. As the number of reactive components increases, generating a solution by hand is very tedious, if not impossible. In this case, computer software such as MATLAB is utilized to generate the desired answer. This lab will explore how to convert differential equations into a MATLAB-compatible form, using Laplace transforms and what MATLAB commands can do to find information of interest about circuits and systems.

In order to model the previous derivative relationships in MATLAB, Laplace transform operations will have to be performed on the volt ampere relationship of capacitor and inductor.

This is true where V(s) and I(S) are the voltages across and the current through the reactive components respectively and *s* is the Laplace operator , a complex number that we write as The impedance of the reactive components can now be defined in Laplace domain as algebraic ratios (rather than as derivative relations).

*Laplace Domain Transfer Function Analysis Using MATLAB*

We illustrate such analysis using the example of an analog circuit. Given the circuit below, find the transfer function. Note that the transfer function is defined as *V*_{out} / *V*_{in}. In order to find the TF, we apply Kirchhoff’s laws or use the voltage divider rule, with the circuit impedances represented in Laplace domain. In this example we will apply the voltage divider rule.

Figure 1. An analog filter that uses no active components (such as op amps, etc.)

This is not a simple circuit. So we must break it down into something easier to calculate. Aim to use the voltage divider rule and break the circuit into the following components:

Figure 2. A symbolic representation of two complex impedances connected as shown

Therefore, the transfer function is defined by

In order to solve this equation, the circuit must be broken down even further. If we apply parallel and series impedance rules, we can get the following. Note that in Z1, *R* and *L* are in series, while *C* is parallel, and the impedance of a resistor is just the resistance because it is not a reactive component.

Substituting numerical values of *L* and *C,* we get the equation below.

Substituting numerical value of R, we get the equation below.

All three components of *Z*_{2} are in series, so we add them together.

Substirtuting numerical values of *R, L, *and* C,* we get the following.

Now combine the impedances to obtain the transfer function using the voltage divider rule.

Expand and simplify to get the following.

Now that we have our transfer function, we must enter it into MATLAB. Because a transfer function is a special type of function, we must use the proper syntax to let MATLAB know that we want a transfer function. A special command called *tf* is used to generate our transfer function. The syntax for the *tf* command is as follows.

tf(num,den)

The *num* and *den* items are arrays that represent the coefficients of the polynomials in the numerator and denominator respectively, in descending order (i.e., starting with the coefficient of the highest power of *s*). Note also that if a particular power of *s *is missing in the polynomial, its coefficient must be entered as 0. The following MATLAB code will generate a desired transfer function for our circuit.

num = [1,0.2,2.01,0.2,1];

den = [1,0.2,3.01,0.3,1];

circuitTF = tf(num,den)

This will generate the following transfer function.

Transfer function:

s^4 + 0.2 s^3 + 2.01 s^2 + 0.2 s + 1

————————————

s^4 + 0.2 s^3 + 3.01 s^2 + 0.3 s + 1

Having obtained the transfer function, we can now use the power of MATLAB to study its properties—among them step and impulse response—as well as a Bode plot and pole zero constellation.

You can study the supplied MATLAB file *sdomainanalysis.m* to see how the whole process can be automated.

*Example Commands (Impulse, Step, Bode, Pzmap)*

For obtaining key properties of the transfer function, we use certain special commands of MATLAB. Some commands to note are *impulse, step, bode, *and* pzmap.* These operations will tell us a number of properties of the circuit in both time and frequency domain.

The key word *impulse* is used to obtain the impulse response of a transfer function. Note that because the Laplace transform of a unit impulse is unity, the impulse response is simply the inversion of the transfer function back to time domain.

The syntax for this command is

impulse(name of the variable representing the transfer function). In our case, it becomes

**impulse(circuitTF).**

The plot below shows the graph presented by MATLAB in response to this command.

Figure 1. Impulse response of circuit as computed by using the *impulse* command in MATLAB

The key word *step* is used to obtain the unit step response of a transfer function. Note that because the Laplace transform of a unit step is (1/s), the step response is simply the inversion of the transfer function back to time domain after multiplying it with 1/s.

The syntax for this command is

step(name of the variable representing the transfer function). In our case, it becomes

**step(circuitTF).**

The graph presented by MATLAB in response to this command is shown below.

Figure 2. Step response of circuit as computed by using the *step* command in MATLAB

The key word *pzmap* is used to obtain the pole zero constellation associated with the transfer function. The syntax for this command is

pzmap(name of the variable representing the transfer function). In our case, it becomes

**pzmap(circuitTF).**

The graph presented by MATLAB in response to this command is shown below.

Figure 3. Pole zero constellation of the circuit transfer function as computed by using the *pzmap* command in MATLAB. Note that both pairs of complex zeroes are located at the same place in the *s* plane.

The key word *bode* is used to obtain the Bode plot of a transfer function. Note that the frequency is plotted in radians/sec and amplitude is in decibels.

The syntax for this command is

bode (name of the variable representing the transfer function). In our case, it becomes

**bode(circuitTF).**

The graph returned by MATLAB in response to this command is shown below.

Figure 4. Bode plot or frequency response (FR) of the circuit as computed by using the *bode* command in MATLAB. Note that the frequency scale is in radians.

Note that the Bode plot is represented in radians/second. Most people are more comfortable with hertz instead, so here is a trick to get the Bode plot to display in hertz.

*How to Plot Frequency Response in Hertz Rather than Radians*

First, generate an array of frequencies in radians to use as a scale for both magnitude and phase plots. This can be done using the colon operator of MATLAB. It can be named anything, but this example will use the letter *W* as the variable.

W = [0.1:0.01:10];

This command creates a row vector (a 1 x N matrix or a matrix of 1 row and *N* columns) of frequencies, *W,* which starts at 0.1 radians/sec and increments with a step size of 0.01 until it reaches the ending upper value of 10 radians/sec.

The reason we chose this range is that the most interesting part of the Bode plot of our circuit occurs between 0.1 rad/sec and 10 rad/sec, and we chose a reasonably small step size to give the graph a good resolution, 0.01 rad/sec. Now, we want to extract the data from the Bode plot and manipulate it. This can be accomplished by putting an array before the *bode* command. We use MAG and PHASE as our variables, but any variable name that is not a key word in MATLAB can be used instead.

[MAG,PHASE] = bode(circuitTF,W);

This will extract the data for the magnitude and phase parts of the graph and store them in the variable MAG and PHASE. Note that the outputs are three-dimensional matrices. In order to change the format to a more manageable one, type in the code below.

MAG1D = MAG(:);

PHASE1D = PHASE(:);

When the data are extracted using this method, magnitude is in a linear form. Standard Bode plots have the magnitude displayed using the decibel scale. Use the normal format to change magnitude to decibels.

MAG1DB = 20*log10(MAG1D);

The final thing of note is that the reference array *W* is interpreted to be in radians per second. In order to change that to frequency in hertz, we use the frequency and radian relationship.

Wfreq = W/(2*pi);

Now use the *subplot* command to generate a Bode plot with frequency on the X axis.

hold on

subplot(2,1,1), plot(Wfreq,MAG1DB)

title(‘Bode plot in frequency’)

ylabel(‘Magnitude (dB)’)

subplot(2,1,2), plot(Wfreq,PHASE1D)

xlabel(‘Frequency (Hz)’)

ylabel(‘Phase (deg)’)

hold off

This will generate the figure below.

Figure 4. Bode plot or frequency response of the circuit as computed by using the *bode* command in MATLAB with further modifications to plot the frequency response in hertz rather than radians.

* *

* *

* *

*Procedure for completing the lab requirements:*

* *

An analog circuit is given below . ** Manually derive the transfer function of this circuit** shown below using the voltage divider rule. Express the transfer function with the coefficients of the highest power of

* *

* *

* *

** **

** **

**Now answer the questions below.**

1. Why does the unit step response of the circuit given in the theory part of this lab settle out at 1 and not at 0? Justify and briefly explain your answer based on the transfer function derived in the theory part. (Hint: it has to do with the DC gain of the circuit and in circuit terms with the impedance of capacitor and inductor at DC.) What kind of a filter does this circuit represent (bandpass, bandstop, low pass, high pass)?

When s goes to infinite it goes to one it’s the transfer functions

2. Why does the unit step response of the circuit given in the procedure part of the lab go to zero rather than unity? Briefly explain and justify your answer.

3. What kind of filter (bandpass, bandstop, low pass, high pass) does the circuit shown in the procedure part represents? Briefly justify your answer.

4. Why does swapping the arms of the filter change the type of filter that is realized?

5. What is the numerical value of impedance of an ideal inductor at DC and as frequency approaches infinity?

6. What is the numerical value of impedance of an ideal capacitor at DC and as frequency approaches infinity?

7. Why does the pole zero map shown above have only two zeroes, while the transfer function has four zeroes? (Hint: use the *roots* command of MATLAB to find out.)

Basic features

- Free title page and bibliography
- Unlimited revisions
- Plagiarism-free guarantee
- Money-back guarantee
- 24/7 support

On-demand options

- Writer’s samples
- Part-by-part delivery
- Overnight delivery
- Copies of used sources
- Expert Proofreading

Paper format

- 275 words per page
- 12 pt Arial/Times New Roman
- Double line spacing
- Any citation style (APA, MLA, Chicago/Turabian, Harvard)

We value our customers and so we ensure that what we do is 100% original..

With us you are guaranteed of quality work done by our qualified experts.Your information and everything that you do with us is kept completely confidential.

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read moreThe Product ordered is guaranteed to be original. Orders are checked by the most advanced anti-plagiarism software in the market to assure that the Product is 100% original. The Company has a zero tolerance policy for plagiarism.

Read moreThe Free Revision policy is a courtesy service that the Company provides to help ensure Customer’s total satisfaction with the completed Order. To receive free revision the Company requires that the Customer provide the request within fourteen (14) days from the first completion date and within a period of thirty (30) days for dissertations.

Read moreThe Company is committed to protect the privacy of the Customer and it will never resell or share any of Customer’s personal information, including credit card data, with any third party. All the online transactions are processed through the secure and reliable online payment systems.

Read moreBy placing an order with us, you agree to the service we provide. We will endear to do all that it takes to deliver a comprehensive paper as per your requirements. We also count on your cooperation to ensure that we deliver on this mandate.

Read more
The price is based on these factors:

Academic level

Number of pages

Urgency