Exercise: Frequency Response...

download Exercise: Frequency Response (Solutions)home.hit.no/~hansha/documents/control/lectures/Solutions/Exercise...Control Engineering ... Exercise: Frequency Response (Solutions) Introduction

of 24

  • date post

    06-Mar-2018
  • Category

    Documents

  • view

    219
  • download

    2

Embed Size (px)

Transcript of Exercise: Frequency Response...

  • ControlEngineering

    UniversityCollegeofSoutheastNorway

    http://home.hit.no/~hansha

    Exercise:FrequencyResponse(Solutions)

    Introduction

    WecanfindthefrequencyresponseofasystembyexcitingthesystemwithasinusoidalsignalofamplitudeAandfrequency[rad/s](Note: = 2)andobservingtheresponseintheoutputvariableofthesystem.

    Thefrequencyresponseofasystemisdefinedasthesteady-stateresponseofthesystemtoasinusoidalinputsignal.Whenthesystemisinsteady-stateitdiffersfromtheinputsignalonlyinamplitude/gain(A)andphaselag()(faseforskyvning).

    Ifwehavetheinputsignal:

    =

    Thesteady-stateoutputsignalwillbe:

    = 1sin( + )

    Where = 18

    is theratiobetweentheamplitudesoftheoutputsignalandtheinputsignal(in

    steady-state).

    Thiscanbeillustratedlikethis:

  • 2

    ControlEngineering

    Thegainisgivenby:

    =

    Thephaselagisgivenby:

    = []

    FindtheFrequencyResponsefromtheTransferfunction

    Aandisafunctionofthefrequencysowemaywrite = , = ()

    Foratransferfunction:

    =()()

    Wehavethat:

    = () NP(NQ)

    Where()isthefrequencyresponseofthesystem,i.e.,wemayfindthefrequencyresponsebysetting = inthetransferfunction.Bodediagramsareusefulinfrequencyresponseanalysis.

    TheGainfunctionisdefinedas:

    = ()

    ThePhasefunctionisdefinedas:

    = ()

    Thiscanbeillustratedinthecomplexplanelikethis:

  • 3

    ControlEngineering

    BodeDiagram

    WenormallyuseaBodediagramtodrawthefrequencyresponseforagivensystem.TheBodediagramconsistsof2diagrams,theBodemagnitudediagram,()andtheBodephasediagram,().BelowweseeanexampleofaBodediagram:

    The()-axisisindecibel(dB),wherethedecibelvalueofxiscalculatedas: = 20[\

    The()-axisisindegrees(notradians!).Weuselogarithmicscaleonthe-axes.

    ComplexNumbers

    Acomplexnumberisdefinedlikethis:

    = +

    Theimaginaryunitisdefinedas:

    = 1

    Whereiscalledtherealpartofandiscalledtheimaginarypartof

    () = ,() =

    Youmayalsoimaginarynumbersonexponential/polarform:

    = Nc

    Where:

    = = d + d

  • 4

    ControlEngineering

    =

    Notethat = cos and = sin

    Rectangularformofacomplexnumber Exponential/polarformofacomplexnumber

    [Figure:R.C.DorfandR.H.Bishop,ModernControlSystems,EleventhEdition:PearsonPrenticeHall]

    MathScript

    MathScripthasseveralbuilt-infunctionsforFrequencyresponse,e.g.:

    Function Description Exampletf Createssystemmodelintransferfunctionform.Youalsocan

    usethisfunctiontostate-spacemodelstotransferfunctionform.

    >num=[1]; >den=[1, 1, 1]; >H = tf(num, den)

    bode CreatestheBodemagnitudeandBodephaseplotsofasystemmodel.Youalsocanusethisfunctiontoreturnthemagnitudeandphasevaluesofamodelatfrequenciesyouspecify.Ifyoudonotspecifyanoutput,thisfunctioncreatesaplot.

    >num=[4]; >den=[2, 1]; >H = tf(num, den) >bode(H)

    bodemag CreatestheBodemagnitudeplotofasystemmodel.Ifyoudonotspecifyanoutput,thisfunctioncreatesaplot.

    >[mag, wout] = bodemag(SysIn) >[mag, wout] = bodemag(SysIn, [wmin wmax]) >[mag, wout] = bodemag(SysIn, wlist)

    semilogx Generatesaplotwithalogarithmicx-scale. >semilogx(w, gain)

    log10 Computesthebase10logarithmoftheinputelements.Thebase10logarithmofzerois-inf.

    >log(x)

    atan Computesthearctangentofx >atan(x)

    Example:

    Wehavethefollowingtransferfunction:

    =()()

    =1

    + 1

    BelowweseethescriptforcreatingthefrequencyresponseofthesysteminaBodeplotusingthebodefunctioninMathScript.Usethegridfunctiontoapplyagridtotheplot.

    % We define the transfer function: K = 1;

  • 5

    ControlEngineering

    T = 1; num = [K]; den = [T, 1]; H = tf(num, den) % We plot the Bode diagram: bode(H); % We add grid to the plot: subplot(2,1,1) grid on subplot(2,1,2) grid on

    ThisgivesthefollowingBodeplot:

    Task1:FrequencyResponse

    Giventhefollowingsystem:

    =4

    2 + 1

    1. Findthemathematicalexpressionsfor []and()usingpen&paper.2. Findthebreakfrequencies(Norwegian:knekkfrekvenser)usingpen&paper3. Findpolesandzeroesforthesystem(checkyouranswerusingMathScript)4. PlottheBodeplotusingMathScript

  • 6

    ControlEngineering

    5. Find []and()forthefollowingfrequencies(bothmanuallyusingyourcalculator(oruseMathScriptascalculator)andcompareusinge.g.thebodefunctioninMathScript):

    [] ()0.1 0.16 0.25 0.4 0.625 2.5

    Comparethecalculatedvalueswiththeplotaretheythesame?

    Solutions:

    Themathematicalexpressionsfor()and():

    () mn = 204 20 (2)d + 1

    () = arctan(2)

    Thebreakfrequency:

    =1=12= 0.5/

    Poles:

    2 + 1 = 0 = 12

    Zeros:None

    WecanfindpolesandzerosinMathScriptusingthepolesandzerofunctions:

    % Transfer function num = [4]; den = [2,1]; H = tf(num,den) % Poles and Zeros poles(H) zero(H)

    WeplottheBodediagramusingMathScriptCode:

    % Transfer function num=[4]; den=[2, 1]; H = tf(num, den) % Bode Plot bode(H)

  • 7

    ControlEngineering

    subplot(2,1,1) grid on subplot(2,1,2) grid on

    BodePlot:

    Weseethattheplotiscorrectaccordingtoourknowledgeabouta1.ordersystem.Weseethatthephaseconvergeto-90degrees,whichisstandardforsucha1.ordersystem.

    Startvalues: 0 = 20 4 12, 0 = atan 0 = 0

    Wefindthevaluesfor()and()forthegivenfrequencies:

    MathScriptCodeusingthebode()functioninMathScript:

    % Margins and Phases wlist = [0.1, 0.16, 0.25, 0.4, 0.625, 2.5]; [mag, phase, w] = bode(H, wlist); magdB=20*log10(mag); %convert to dB mag_data = [w, magdB] phase_data = [w, phase]

  • 8

    ControlEngineering

    Thisgivesthefollowingresults:

    () ()0.1 11.9 -11.30.16 11.6 -17.70.25 11.1 -26.50.4 9.9 -38.70.625 7.8 -51.32.5 -2.1 -78.6

    Alternatively,wecanusethemathematicalexpressionsfor()and():

    gain = 20*log10(4) - 20*log10(sqrt((2*w).^2+1)); phase = -atan(2*w); phasedeg = phase * 180/pi; %convert to degrees

    Theresultsisthesame.

    Ifweuseacalculator,thisishowweneedtodoit.

    Task2:BodeDiagrams

    Dothefollowingforthesystemsgivenbelow.

    1. Findthemathematicalexpressionsfor []and()usingpen&paper.2. Findthebreakfrequencies(Norwegian:knekkfrekvenser)usingpen&paper3. PlottheBodeplotusingMathScript(Usethebode()function)4. Findpolesandzeroesforthesystem(checkyouranswerusingMathScript)

    Task2.1

    Giventhefollowingtransferfunction:

    =5

    + 1 (10 + 1)

    Solutions:

    Themathematicalexpressionsfor()and():

    () mn = 205 20 ()d + 1 20 (10)d + 1

    () = arctan() arctan(10)

    Breakfrequencies:

    [ =1[=11= 1/

    d =1d=

    110

    = 0.1/

  • 9

    ControlEngineering

    Bodeplot:

    clear clc % Transfer function K = 5; T1 = 1; T2 = 10; num = [K]; den1 = [T1, 1]; den2 = [T2, 1]; den = conv(den1,den2); H = tf(num, den) % Bode Plot bode(H) subplot(2,1,1) grid on subplot(2,1,2) grid on

    Note!Weusedthefunctionconvtocreatethedenominator,butwecouldalsodothismanually:

    + 1 10 + 1 = 10d + + 10 + 1 = 10d + 11 + 1

    Thedenominatorcanthenbedefinedas:

    den=[10, 11, 1]

    Polesandzeroes:

  • 10

    ControlEngineering

    [ = 1

    d = 110

    = 0.1

    Nozeros.

    UsethepolesandzerofunctionsinMathScript.

    Task2.2

    Giventhefollowingtransferfunction:

    =1

    + 1 d

    Solutions:

    Themathematicalexpressionsfor()and():

    () mn = 20 ()d 220 ()d + 1 = 20 40 ()d + 1

    () = 90 2arctan()

    Breakfrequencies:

    =1=11= 1/

    Bodeplot:

    clear clc % Transfer function num = [1]; den1 = [1, 0]; den2 = [1, 1]; den3 = [1, 1]; den = conv(den1,conv(den2,den3)); H = tf(num, den) % Bode Plot bode(H) subplot(2,1,1) grid on subplot(2,1,2) grid on

  • 11

    ControlEngineering

    Polesandzeroes:

    Poles:

    [ = 0

    d = 1

    u = 1

    Zeros:None

    UsethepolesandzerofunctionsinMathScript.

    Task2.3

    Giventhefollowingtransferfunction:

    =3.2wdx

    3 + 1

    Solutions:

    Themathematicalexpressionsfor()and():

    () mn = 203.2 20 (3)d + 1

    () = 2 arctan(3)

    Orindegrees:

  • 12

    ControlEngineering

    = 2 arctan(3) 180

    Breakfrequencies:

    =1=13= 0.33/

    Bodeplot:

    MathScriptCode:

    s=tf('s'); K=3.2; T=3; H1=tf(K/(T*s+1)); delay=2; H2=set(H1,'inputdelay',delay); bode(H2);

    BodePlot:

    Weseethattheplotiscorrectaccordingtoourknowledgeaboutasystemwithdelay.Weseethatthephasecurveisverysteep,whichisstandardforsuchasystem.

    Polesandzeroes:

    Poles:

    [ = 13= 0.33

    Zeros:None:

    UsethepolesandzerofunctionsinMathScript.

  • 13

    ControlEngineering

    Task2.4

    Giventhefollowingtransferfunction:

    =(5 + 1)

    2 + 1 (10 + 1)

    Solutions:

    Themathematicalexpressionsfor()and():

    () mn = 20 (5)d + 1 20 (2)d + 1 20 (10)d + 1

    () = arctan(5) arctan(2) arctan(10)

    Breakfrequencies:

    [ =1[=15= 1/

    d =1d=12= 0.5/

    u =1u=

    110

    = 0.1/

    Bodeplot:

    clear clc % Transfer function num = [5, 1]; den1 = [2, 1]; den2 = [10, 1]; den = conv(den1,den2); H = tf(num, den) p = poles(H) z = zero(H) % Bode Plot bode(H) subplot(2,1,1) grid on subplot(2,1,2) grid on

  • 14

    ControlEngineering

    Polesandzeroes:

    p =

    -0.1

    -0.5

    z =

    -0.2

    UsethepolesandzerofunctionsinMathScript.

    Task3:Steady-stateResponse

    Giventhefollowingsystem:

    =()()

    =1

    + 1

    Thefrequencyresponseforthesystemisthen:

  • 15

    ControlEngineering

    (YoumayuseMathScripttoseeifyougetthesamefrequencyresponse)

    Foragiveninputsignal: