The post Effect of Zeros on System Response appeared first on Electrical Academia.

]]>**Effect of Zeros on System Response with Example**

Find the time response of the output y (t) of the system in the factored form

\[G(s)=\frac{(s+5)({{s}^{2}}+1)}{(s+1){{(s+2)}^{2}}(s+3)}\]

Subject to the input u (t) = sin t for t≥0. Does y (t) contain any sinusoidal component? Also, draw a plot of the poles and zeros in the s-plane.

**Solution**

In MATLAB Script 8, we deﬁne zz = [-5; i; -i], pp = [-1; -2; -2; -3] and kk = 1. The TF form of G (s) is obtained as **[numG, denG] = zp2tf (zz, pp, kk),** yielding **numG = [1 5 1 5]** and **denG = [1 8 23 28 12]**.We generate the time vector **t = [0:0.1:20]’** and the input vector **u = sin (t)**. Then the command **lsim (numG, denG, u, t) **is used to simulate the time response y (t), which is shown in Figure 1. Note that y (t) consists solely of the modes of G(s) and does not exhibit any sinusoidal component due to the input u (t). To understand this phenomenon, we obtain the Laplace transform of u (t) as

\[U(s)=L\left\{ u(t) \right\}=L\left\{ sin(t) \right\}=\frac{1}{{{s}^{2}}+1}\]

Then the Laplace transform of the output y (t) is the product

$Y(s)=G(s)U(s)=\frac{(s+5)}{(s+1){{(s+2)}^{2}}(s+3)}$

Note that the zeros of G(s) at s = ±j1 cancel the poles of U (s). The response y (t) can be found from the command **impulse ([1 5], denG, t)** and will be identical to the response obtained from the **lsim command**. The MATLAB commands in Script 8 will compute the time response and make the plots as shown in figure 1 and 2.

%Script 8: Matlab Code to compute output Impulse Response y(t) clear all;close all;clc zz = [-5; 1i; -1i]; % Zeros of G(s) pp = [-1; -2; -2; -3]; % Poles of G(s) kk = 1; % Gain of G(s) % Generate G(s) in Transfer Function(TF) form [numG,denG] = zp2tf(zz,pp,kk);% convert G(s) to TF form t = 0:0.1:20;% generate time array u = sin(t); % generate input signal lsim(numG,denG,u,t) % simulate system response y(t) impulse([1 5],denG,t) % impulse response (of y(t)) without zeros at ±j pzmap(numG,denG)% plot poles and zeros of G(s) in s—plan

**Results**

Fig.1: Impulse Response of Transfer Function

Fig.2: Pole Zero Plot of Transfer Function

The post Effect of Zeros on System Response appeared first on Electrical Academia.

]]>The post System Stability Analysis using MATLAB appeared first on Electrical Academia.

]]>If p* _{i}* is a pole of G(s), then the natural, or zero-input, the response of G(s) will consist of the mode functions e

If all the poles are in the open left-half plane except for distinct poles on the imaginary axis and at the origin, the natural response will consist of undamped sinusoids or a nonzero constant, and the system is said to be **marginally stable**.

If some of the poles are in the right-half of the s-plane or on the imaginary axis with multiplicity greater than one, then the natural response will be unbounded and the system is said to be **unstable**.

For G(s) given in TF form, the MATLAB function **tf2zp** can be used to determine the poles of G(s) and its stability. Alternatively, since we are interested only in the poles, we can apply the polynomial roots function **root** to the denominator of G(s) to ﬁnd its poles. The following example illustrates the use of roots to determine the system’s stability.

Find the poles of the transfer function

$G(s)=\frac{1.5s+1}{{{s}^{3}}+2{{s}^{2}}+2.5s+0.5}$

and determine whether the system is stable. Plot the poles and zeros of G(s) in the s-plane. Finally, demonstrate the system stability by simulating the impulse response.

**Solution**

Deﬁne the row vectors **numG = [1.5 1]** and **denG = [1 2 2.5 0.5]** to represent the numerator and denominator of G(s), respectively. Using the command **roots (denG)**, we ﬁnd the poles of G(s) to be at s = -0.2408 and -0.8796 ± j1.1414. Since all the poles have negative real parts, that is, they are all in the open left-half plane, the system is **asymptotically stable**. The impulse response can be found from the command** impulse (numG, denG)**, and will decay to zero as shown in figure 1. The MATLAB commands in Script 7 will compute the poles and zeros and make the plot as shown in figure 2.

From roots command, we obtained the following result:

Poles |

-0.8796 + 1.1414i |

-0.8796 – 1.1414i |

-0.2408 + 0.0000i |

% Script 7: Matlab Code to find poles and impulse response clear all;close all;clc numG = [1.5 1]; % Create G(s) as a ratio of numerator &amp;amp; denumerator denG = [1 2 2.5 0.5]; roots(denG) % find poles of G(s) pzmap(numG,denG) % plot the poles and zeros impulse(numG,denG) % simulate impulse response

**Result**

Fig.1: Impulse Response of a Transfer Function

Fig.2: Pole Zero Plot for System Stability

The post System Stability Analysis using MATLAB appeared first on Electrical Academia.

]]>The post Zero State Response using Matlab appeared first on Electrical Academia.

]]>In addition to computing and plotting the impulse and step responses of a system, MATLAB can be used to ﬁnd and display the response to general functions of time. This is done with the **lsim command**, which can be used in a variety of ways. In its simplest form, the user speciﬁes the system’s transfer function, a vector of input values, and a vector of time points.

If the lsim command, which performs linear simulation, is given with no output variable, the plot of the response is drawn but no numerical values are returned.

A more useful way to use this command is to specify the system output (y) as a result and then to plot both the output and the input (u) versus time. We illustrate the use of lsim in the following example by solving for the zero-state response to an input signal that is piecewise constant.

**Zero State Response using Matlab Example**

Find the zero-state response of the system G(s) to the input u (t)

\[G(s)=\frac{3s+2}{2{{s}^{3}}+4{{s}^{2}}+5s+1}\]

\[u(t)=\left\{ \begin{matrix} \begin{matrix} 0 & t<0 \\\end{matrix} \\ \begin{matrix} 2 & 0\le t<2 \\\end{matrix} \\ \begin{matrix} 0.5 & t\ge 2 \\\end{matrix} \\\end{matrix} \right.\]

**Solution**

Once the system’s transfer function has been deﬁned by creating the vector of polynomial coefﬁcients **numG** and **denG**, we need to create vectors of time points and input values. The only constraints are that the time points must be uniformly spaced and that the two vectors must have the same number of elements. We start by deﬁning time to be a column vector that has a sufﬁciently small time increment (say, 0.02 s) to yield a smooth response plot and a large enough maximum time to show all of the transients. The command **time = [0:0.02:10] ‘** will accomplish this for the system and input signal under consideration.

The **input vector u** can be created in a number of ways. As shown in Script 6, we ﬁrst use the **ones command** to make **u** be a vector having the same dimension as time but with all of its values equal to 2.0.Then we use a for loop to change the values of all the elements corresponding to t≥2 from 2.0 to 0.5. Note that the range of the index i for which the values are changed is calculated by MATLAB based on the properties of **time and u** by using the **commands min, find, and length**. Speciﬁcally, **min (find (time>=2. 0))** is the index of the ﬁrst time point that is greater or equal to 2.0 s. This is because **find (time>=2. 0)** returns the indices of all the time points that are 2.0 or greater, and the min function selects the smallest of these. Also, length (u) is the index of the last element of the **input vector u**. This approach has the advantages that one does not have to calculate the starting and ending values of the **index i** and that no modiﬁcations are required if the number of time points is subsequently changed, due to a change in either the time increment or the maximum time.

The values of the response are computed by the command lsim and are stored in the column vector y. Then both y and u are plotted versus time, resulting in Figure.

%Script 6: Matlab Code to compute Zero-Response clear all;close all;clc numG = [3 2]; denG = [2 4 5 1]; % create G(s) as ratio of numerator & denumerator time = [0:0.02:10]; % 501 time points, every 0.02 s u = 2.0*ones(size(time)); % construct 501 input values %Here, min (find (time>=2. 0)) is the index of the first time point %that is greater or equal to 2.0 s. This is because find (time>=2. 0) %returns the indices of all the time points that are 2.0 or greater, %and the min function selects the smallest of these. %also, length (u) is the index of the last element %of the input vector u for i=min(find(time>=2.0)):length(u) % start with all points = 1.0 u(i) = 0.5; % then change to 0.5 if t>=2.0 end %lsim command performs linear simulation to compute the response %For more understanding, write "help islm" in Maltab Command Window y = lsim(numG,denG,u,time); % Plotting the input & Output Response plot(time,y,time,u,'--')

**Result**

Fig.1: Zero State Response using Matlab Example

The post Zero State Response using Matlab appeared first on Electrical Academia.

]]>The post Step Response using Matlab Transfer Function appeared first on Electrical Academia.

]]>The Laplace transform of a system’s unit step response is the product of the system’s transfer function G(s), and 1/s, the transform of the unit step function. The poles of the resulting transform are the poles of G(s) and a pole at s = 0 (due to the unit—step input). The zeros and gain of the step response are the same as those of the transfer function. The step response can be computed and plotted using the **step** command from the Control System Toolbox. This command has the same options as does the **impulse** command for plotting and returning numerical values.

The gain at s = 0 is G(0) and is known as the **DC gain**. It is the ratio of the constant terms in the numerator and denominator polynomials. We can compute the DC gain directly from the TF form using the Control System Toolbox command **dcgain**** (num, den)**.

In the following example, we use MATLAB to construct the Laplace transform of a step response, to plot the response with **the impulse command**, and to compare the result with a plot obtained using **the step command**. We also illustrate the use of the initial- and ﬁnal-value theorems.

For the transfer function G(s)

\[G(s)=\frac{3s+2}{2{{s}^{3}}+4{{s}^{2}}+5s+1}\]

Obtain a plot of the step response by adding a pole at s = 0 to G(s) and using the impulse command to plot the inverse Laplace transform. Compare the response with that obtained with the step command applied to G(s). Also, determine the system’s DC gain. Use the initial- and ﬁnal—value theorems to check your results.

**Solution**

To add a pole at s = 0, we multiply the denominator polynomial by s. In MATLAB this can be done in either of two ways.

**One method** is to use the “**conv” command**, which will multiply two polynomials by performing a discrete convolution of the row vectors containing their coefﬁcients. In this example, we want to multiply the denominator of G(s) by the polynomial s, which in MATLAB is represented by the row vector [1 0]. To do this, we enter **denstep= conv (denG,[1 0])**.

**The other method** is to append a 0 to the row vector denG with the statement **denstep = [denG 0]**. The numerator of the transform of the step response is the same as that of G(s), so we write **numstep = numG**. Having obtained the transform of the unit step response in terms of the row vectors numstep and denstep, we use the **impulse** command to get the inverse transform, which is the step response shown in Figure 1. Alternatively, we could have used the transfer function G(s) as expressed by the polynomials **numG** and **denG** and the** step** command to generate the same plot. The calculation of the DC gain gives a value of 2.0, which agrees with G (0) as obtained by letting s = 0 in (1). These commands are contained in Script 5.

**Matlab Code to Calculate and Plot Step Response**

%Script 5: Matlab Code for Step Response from G(s) clear all;close all;clc numG=[3 2]; denG=[2 4 5 1]; % create G(s) as ratio of numerator & Denumerator numstep=numG; % no change to numerator denstep=[denG 0]; % add pole at s=0 to G(s) %A plot of the step response by adding a pole at s = 0 %to G(s) and using the IMPULSE command impulse(numstep,denstep) % A plot of the step response using STEP command applied to G(s) step(numG,denG,'r') % Calcualte G(0) from TF Form dcgain(numG,denG)

**Result**

Fig.1: Step Response using Matlab Transfer Function

Note: As mentioned in the text, both IMPULSE and STEP commands produce the same plot. This can be checked by commenting one command at a time and obtain the response plot.

If y_{s}(t) denotes the system’s unit step response, we can see from figure 1 that y_{s}(0+)=0 and y_{s}(∞)=2. To verify these values analytically, we write the Laplace transform of the step response as

$Ys(s)=\frac{1}{s}G(s)=\frac{3s+2}{2(2{{s}^{3}}+4{{s}^{2}}+5s+1)}$

The initial-value theorem gives

${{y}_{s}}(0+)=\underset{s\to \infty }{\mathop{\lim }}\,s{{Y}_{s}}(s)=\underset{x\to \infty }{\mathop{\lim }}\,\frac{3s+2}{2{{s}^{3}}+4{{s}^{2}}+5s+1}=0$

And the final-value theorem gives

${{y}_{s}}(\infty )=\underset{s\to 0}{\mathop{\lim }}\,s{{Y}_{s}}(s)=\underset{x\to 0}{\mathop{\lim }}\,\frac{3s+2}{2{{s}^{3}}+4{{s}^{2}}+5s+1}=2$

The post Step Response using Matlab Transfer Function appeared first on Electrical Academia.

]]>The post Impulse Response due to Repeated Poles using Matlab Transfer Function appeared first on Electrical Academia.

]]>Up to this point the discussion has been restricted to distinct poles. Either real or complex. For a repeated pole there will be more than one term in the time response, with the number of terms depending on the multiplicity of the pole. For a pole at s = p of multiplicity m = 2, we can write the Laplace transform of the response as

\[\begin{matrix} G(s)=\frac{A}{{{(s-p)}^{2}}}+\frac{B}{s-p}+terms\text{ }involving\text{ }other\text{ }poles & \cdots & (1) \\\end{matrix}\]

Where

\[\begin{align} & A={{\left. [{{(s-p)}^{2}}G(s)] \right|}_{s=p}} \\ & and \\ & B={{\left. \left\{ \frac{d}{ds}[{{(s-p)}^{2}}G(s)] \right\} \right|}_{s=p}} \\\end{align}\]

For t > 0, the corresponding impulse response is

$\begin{matrix} g(t)=At{{e}^{pt}}+B{{e}^{pt}}+terms\text{ }involving\text{ }other\text{ }terms & \cdots & (2) \\\end{matrix}$

Similar relationships exist for poles of multiplicity three or higher, but they are seldom needed. The residue command is able to compute the coefﬁcients for repeated poles, and for m = 2 they are listed as B followed by A as can be seen in (2).

For the system whose differential equation is

$\overset{..}{\mathop{y}}\,+\overset{.}{\mathop{y}}\,+0.25y=\overset{.}{\mathop{u}}\,+2u$

Do a partial fraction expansion and write the impulse response as the sum of two individual functions of time.

**Solution**

The transfer function is

\[\begin{matrix} G(s)=\frac{s+2}{{{s}^{2}}+s+0.25}=\frac{s+2}{{{(s+0.5)}^{2}}}=\frac{A}{{{(s+0.5)}^{2}}}+\frac{B}{s+0.5} & \cdots & (3) \\\end{matrix}\]

Which has a pole at s=-0.5 of multiplicity m=2. Using the residue command results in the column vectors

resG = |
polG = |

1.0000 | -0.5000 |

1.5000 | -0.5000 |

And the scalar otherG = []. Associating the ﬁrst element of resG with A and the second element with B, we can write

$G(s)=\frac{1.0}{{{(s+0.5)}^{2}}}+\frac{1.5}{s+0.5}$

From (1) and (2), where there are no other poles, we see that for t>0 the impulse response is

$g(t)=1.0t{{e}^{-0.5t}}+1.5{{e}^{-0.5t}}$

% Script 4: Matlab Code to Compute & Plot Impulse Response Function clear all;close all;clc numG = [1 2]; denG = [1 1 0.25]; % Numerator & Denumerator from text (Equation (3)) [resG,polG,otherG] = residue(numG,denG) % residues and poles computation impulse(numG,denG) % plotting impulse response

**Result**

The post Impulse Response due to Repeated Poles using Matlab Transfer Function appeared first on Electrical Academia.

]]>The post Impulse Response due to Real and Complex Poles using Matlab Transfer Function appeared first on Electrical Academia.

]]>In addition to computing the time response of the output, we can use MATLAB to evaluate and display the time response due to an individual real pole or to a pair of complex poles. Recall that a real pole at s = p with residue r will result in the time function

$y(t)=r{{e}^{pt}} $ for t>0.

If a pole is complex, say at s_{1}=σ+jω, then its complex conjugate s_{2}=σ+jω will also be a pole. The residue at s_{1} will be a complex number, say ${{r}_{1}}=K{{e}^{j\phi }}$, and the residue at s_{2} will be the complex conjugate of r_{1}, namely, ${{r}_{2}}=K{{e}^{-j\phi }}$. It can be shown that for t>0 the time response due to this pair of complex poles is

$y(t)=2K{{e}^{\sigma t}}\cos (\omega t+\phi )$

To simplify the calculation of these responses, we have created two functions designated as named **rpole2t** and **cpole2t**. The former has as its arguments the value of the real pole, its residue, and a time vector. The function returns a column vector of time response values, one per time point. The latter function has the value of the complex pole with the positive imaginary part as its ﬁrst argument, the residue at this pole as the second argument, and a time vector as the ﬁnal argument.

Use the poles and residues of the transfer function G(s) to display the components of g(t) due to the real pole at s = -0.2408 and the complex poles at s = -0.8796 1± j1.1414. Verify that the sum of these two responses equals the impulse response shown in tutorial 2.

\[\begin{matrix} G(s)=\frac{3s+2}{2{{s}^{3}}+4{{s}^{2}}+5s+1} & \cdots & (1) \\\end{matrix}\]

We can write the partial-fraction expansion of the transfer function as

\[\begin{matrix} G(s)=\frac{0.3734}{s+0.2408}+\frac{-0.1867-j0.5526}{s+0.8796-j1.1414}+\frac{-0.1867+j0.5526}{s+0.8796+j1.1414} & \cdots & (2) \\\end{matrix}\]

**Solution**

Referring to Table 1 in tutorial 2,

Table.1: Poles and residues of G(s)

Pole |
Residue |

-0.2408 | 0.3734 |

-0.8796 +j1.1414 | -0.1867 -j0.5526 |

-0.8796 -j1.1414 | -0.1867 + j0.5526 |

We use the function **rpole2t** with the pole s = -0.2408 and the residue r = 0.3734 to obtain the response due to the one real pole of G(s). The resulting time function is the inverse Laplace transform of the ﬁrst term of G(s). For the other two terms in (2), which result from the complex poles, we use the pole having the positive imaginary part, namely s = -0.8796 + j 1.1414 and its residue r = -0.1867 – j0.5526. The MATLAB instructions that will accomplish these steps and plot the responses are shown in Script 3, and the resulting responses are shown in Figure 1.

% Script 3: Impuse Response due to rel and complex poles clear all;close all;clc numG = [3 2]; denG = [2 4 5 1]; % create G(s) as ratio of polys [resG,polG,otherG] = residue(numG,denG) % residues &amp; poles of G(s)from equation (1) t = [0:0.1:20]; % column vector of time points ycmplx = cpole2t(polG(1),resG(1),t); % response due to complex pole yreal = rpole2t(polG(3),resG(3),t); % response due to real pole ytot = ycmplx + yreal; % y(t) is sum of the two plot(t,ytot,t,ycmplx,t,yreal,'--') % plot the three curves

**Function rpole2t**

function y_out = rpole2t(real_p,residue,time) % This function computes Inverse Laplace Transformation %for a real pole in order to generatea time function %Inputs for this function are: %real_p - real pole % residue - residue at the real pole % time - a time vector % That's how we compute the response as % y(t) = residue * exp(real_p*t) y_out = 0*time; for t=1:length(time), y_out(t) = residue*exp(real_p*time(t)); end y_out = real(y_out); %%%%%%%%%%

**Function cpole2t**

function y_out = cpole2t(comp_p,residue,time) % This function computes Inverse Laplace Transformation %for two complex conjugate poles in order to generate a time function % %Inputs for this function are: %comp_p - complex poles with Positive Imaginary Parts % residue - residue at the complex pole % time - a time vector %Output: %y_out - indicates time response vector as an output % % That's how we compute the response % y(t) = 2*K*exp(m*t)*cos(Omega*t + phii) % where residue = K*exp(j*phii), comp_p = m + j*Omega m = real(comp_p); % Pole zero component Omega = imag(comp_p); % Pole imaginary component K = abs(residue); % to compute absolute value phii = angle(residue); % to compute angle phii y_out = 0*time; for t=1:length(time), y_out(t) = 2*K*exp(m*time(t))*cos(Omega*time(t)+phii); end y_out = real(y_out); %%%%%%%%%%

**Result**

Fig.1: Impulse Response for Real and Complex Poles

So, from the graph, it’s evident that the “Total Response” here is the same as we obtained in tutorial 2.

The post Impulse Response due to Real and Complex Poles using Matlab Transfer Function appeared first on Electrical Academia.

]]>The post Impulse Response using Matlab Transfer Function appeared first on Electrical Academia.

]]>Once a transform (or transfer function) G(s) has been deﬁned in MATLAB, operations can be performed to compute and display the corresponding time function g(t), known as the inverse Laplace transform. If the poles are known, G(s) can be written as a partial-fraction expansion from which the individual transform terms can be associated with time functions. MATLAB provides the function **residue** for computing the poles and their corresponding residues in a partial-fraction expansion, from which we can obtain g(t) in analytical form. Alternatively, using the property that g(t) is the unit-impulse response corresponding to G(s), the Control System Toolbox function** impulse** can be directly applied to obtain g(t) in numerical form, from which it can be plotted.

Find the partial-fraction expansion and g (t)

The transfer function of a ﬁxed linear system is

\[G(s)=\frac{3s+2}{2{{s}^{3}}+4{{s}^{2}}+5s+1}\]

Create the transfer function in MATLAB and determine its poles and zeros. Perform a partial-fraction expansion of G(s), and plot the Impulse response of the system.

**Solution**

The transfer function is implemented by deﬁning the row vectors **numG = [3 2]** and **denG = [2 4 5 1]**, which contain the coefﬁcients of the numerator and denominator polynomials, respectively, as indicated in Script 2. To obtain the zeros, poles, and gain of G(s), we enter **[zG, pG, kG] = tf2zp (numG, denG)**. Doing this, we ﬁnd that G(s) has a zero at s = -0.6667 and poles at s = -0.2408 and -0.8796± j1.1414, and the gain is 3/2 = 1.50. Thus we can write the transfer function in factored form as

\[G(s)=\frac{1.5(s+0.6667)}{(s+0.2408)(s+0.8796-j1.1414)(s+0.8796+j1.1414)}\]

To write G(s) in a partial-fraction expansion, we use the residue command as in **[resG,polG, otherG] = residue (numG, denG)** . The result is a column vector resG containing the residue at each of the poles of G(s), a column vector polG containing the poles, and a scalar otherG consisting of a constant that will be non-empty only if the degree of the numerator of G(s) equals the degree of the denominator. Doing this, we obtain the poles and residues given in Table 1.

**Table.1: Poles and residues of G(s) in Example**

Pole |
Residue |

-0.2408 | 0.3734 |

-0.8796 +j1.1414 | -0.1867 -j0.5526 |

-0.8796 -j1.1414 | -0.1867 + j0.5526 |

The third result produced by the residue command is the scalar otherG, which has no value because there are no other terms in the expansion. Thus MATLAB sets it to [ ], which is referred to as the empty element.

From these MATLAB results we can write the partial-fraction expansion of the transfer function as

\[G(s)=\frac{0.3734}{s+0.2408}+\frac{-0.1867-j0.5526}{s+0.8796-j1.1414}+\frac{-0.1867+j0.5526}{s+0.8796+j1.1414}\]

The impulse response can be computed by using the impulse command, which can take one of the several different forms. The simplest of these is to enter** impulse (numG, denG)**, which will cause a plot of g (t) to be displayed using a time interval selected by MATLAB.

Another option is to enter **impulse (numG, denG, time)** where time is a column vector of time points that has been deﬁned previously.

A third option is to use a single left-hand argument as in **y = impulse (numG, denG, time)** with the time vector speciﬁed as before. This form of the command will return the output values for each time point in the column vector y, which can then be plotted versus time by entering **plot (time, y)**.

The corresponding impulse response for above example appears in Figure 1.

% Script 2 : Matlab Code for calculating Partial-fraction expansion and Impulse Response clear all;close all;clc numG = [3 2], denG =[2 4 5 1] % create G(s) from numerator & denomerator [zG,pG,kG]=tf2zp(numG,denG) %zeros, poles, & gain of G(s) [resG,polG,otherG] = residue(numG,denG) % residues & poles of G(s) impulse(numG,denG) %impulse response

**Result**

**Comment:** If the degree of the numerator of G(s) is the same as the degree of its denominator, the otherG part of the result of the residue command will be a constant which represents an impulse component in g(t). While the residue command returns this value correctly, the impulse command will not include it in the response. It is up to the user to keep track of nonempty otherG part of a partial-fraction expansion.

**What IF?**

Try changing the coefficients of the numerator of G(s) while leaving the denominator alone. Look at the effects on the poles, zeros, gain, residues, and impulse response. You should find that all of the above are affected except the poles. Looked at another way, by changing the numerator of G(s) but not it’s denominator, you are affecting the weight of the system’s mode functions but not the mode functions themselves.

The post Impulse Response using Matlab Transfer Function appeared first on Electrical Academia.

]]>The post Transfer Function Calculation Matlab with Example appeared first on Electrical Academia.

]]>Consider a ﬁxed single-input/single-output linear system with input u(t) and output y(t) given by the differential equation

$\begin{matrix} \overset{..}{\mathop{y}}\,+6\overset{.}{\mathop{y}}\,+5y=4\overset{.}{\mathop{u}}\,+3u & \cdots & (1) \\\end{matrix}$

Applying the Laplace transform to both sides of (1) with zero initial conditions, we obtain the transfer function of the system from the input U (s) to the output Y(s) in** TF form** as the ratio of polynomials:

$\begin{matrix} G(s)=\frac{4s+3}{{{s}^{2}}+6s+5} & \cdots & (2) \\\end{matrix}$

Alternatively, this transfer function can be expressed in terms of its zeros z_{i}, poles p_{j}, and gain K in the factored, or **Zero-Pole (ZP)** form, as

$\begin{matrix} G(s)=\frac{4(s+0.75)}{(s+1)(s+5)} & \cdots & (3) \\\end{matrix}$

Which shows that G(s) has a single zero at s = -0.75, two poles at s = -1 and -5, and a gain of 4.

If we know the numerator and denominator polynomials of G(s), we can represent the model in MATLAB by creating a pair of row vectors containing the coefﬁcients of the powers of s, in descending order, of the numerator and denominator polynomials. For the transfer function in (2), we would enter **numG = [4 3]** and **denG = [1 6 5]**.

If the transfer function is known in terms of its zeros, poles, and gain, we can create the model by entering column vectors for the zeros and poles, and enter the gain as a scalar. Then the model is represented by these three quantities, which can be used as arguments in commands for performing calculations. To create the system described in (3), we would enter the commands **zG = -0.75, pG = [-1; -5],and kG = 4.**

When a model has been described in MATLAB in either one of these forms, the Control System Toolbox provides several functions to obtain the description in the other form.

For example, if the numerator and denominator polynomials are known as the vectors numG and denG, we merely enter the MATLAB command **[zz, pp, kk] = tf2zp (**numG**, **denG**)**. The result will be the three-tuple [zz, pp, kk] , which consists of the values of the zeros, poles, and gain of G(s), respectively. Alternatively, if the zeros, poles, and gain are known as the column vectors zG and pG and the scalar kG, we would enter the command **[num, den] = zp2tf (**zG**, **pG**, **kG**)** .

Once we have the system model in either the TF or the ZP form, we can obtain a graphical representation of the transfer functions poles and zeros by using the pzmap command from the Control System Toolbox. The two forms of the command that are applicable to transfer-function models are **pzmap(**numG**,**denG**) **and **pzmap(**pG**, **zG**)**, where in the ﬁrst case the arguments are row vectors and in the latter case, the arguments are column vectors. In either case, a region of the s-plane is shown with the zeros indicated by “O” and the poles by “X”.

Convert G(s) to Factored Form

Find the transfer function in both the polynomial (TF) and factored (ZP) forms for the fourth-order system whose differential equation is

\[\overset{….}{\mathop{y}}\,+3\overset{…}{\mathop{y}}\,+4\overset{..}{\mathop{y}}\,+2.5\overset{.}{\mathop{y}}\,+0.8y=3\overset{..}{\mathop{u}}\,+5\overset{.}{\mathop{u}}\,+7u\]

Solution

Taking the Laplace transform of the differential equation with zero initial conditions, we obtain the polynomial form of the transfer function as

\[G(s)=\frac{3{{s}^{2}}+5s+3}{{{s}^{4}}+3{{s}^{3}}+4{{s}^{2}}+2.5s+0.8}\]

The MATLAB commands in Script 1 will create the polynomial form of G(s) and then use it to determine the factored form. From the numerical output we ﬁnd that G(s) has zeros at s = -0.8333± j1.2802, poles at s == -0.4548±j0.5420 and s = -1.0452±j0.7110, and a gain of 3.

% Script 1: Matlab Code to Find the transfer function %in both the polynomial (Transfer-Function) and factored (Zero-Pole) forms numG = [3 5 7] % enter transfer function numerator denG = [1 3 4 2.5 0.8] % ...and denominator polynomials % convert to factored (ZP) form [zz,pp,kk] = tf2zp(numG,denG) pzmap(numG,denG) % pzmap from TF form pzmap(pp,zz) % pzmap from ZP form

The post Transfer Function Calculation Matlab with Example appeared first on Electrical Academia.

]]>