东南大学Matlab作业3_第1页
东南大学Matlab作业3_第2页
东南大学Matlab作业3_第3页
东南大学Matlab作业3_第4页
东南大学Matlab作业3_第5页
已阅读5页,还剩15页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

PAGE1PAGE4MatlabWorksheet3PartAUsingfunctionconv_m.mtomakeconvolutionbetweenthefollowingtofunctions(xandh):x=[3,11,7,0,-1,7,-5,0,2];h=[11,9,0,-7,-3,2,0-1];nx=[-2:6];nh=[0:7];Plotthefunctionsandconvolutionresults.Answer:home_work_3_A_1.mx=[3,11,7,0,-1,7,-5,0,2];h=[11,9,0,-7,-3,2,0-1];nx=[-2:6];nh=[0:7];[y,ny]=conv_m(x,nx,h,nh);subplot(3,1,1);stem(nx,x);ylabel('x[n]');axis([-610-2020]);subplot(3,1,2);stem(nh,h);ylabel('h[n]');axis([-610-2020]);subplot(3,1,3);stem(ny,y);xlabel('n');ylabel('y[n]');axis([-610-5050]);conv_m.mfunction[y,ny]=conv_m(x,nx,h,nh)%convolutionfunction%conv_m.mnyb=nx(1)+nh(1);nye=nx(length(x))+nh(length(h));ny=[nyb:nye];y=conv(x,h);endPlotthefrequencyresponseoverforthefollowingtransferfunctionbyletting,whereisthefrequency(rad/sample).,withappropriatelabelsandtitle..Answer:home_work_3_A_2.mdelta=0.01;Omega=0:delta:pi;z=exp(j.*Omega);H=z./(z.^2+1.6*z+0.9);subplot(2,1,1);plot(Omega,abs(H),'m','LineWidth',2);xlabel('0<\Omega<\pi');ylabel('|H(\Omega)|');axis([0pi0max(abs(H))]);subplot(2,1,2);plot(Omega,atan2(imag(H),real(H)),'k','LineWidth',2);xlabel('0<\Omega<\pi');ylabel('-\pi<\Phi_H<\pi')title('frequencyresponse');axis([0pi-pipi]);Useffttoanalysefollowingsignalbyplottingtheoriginalsignalanditsspectrum..axis([0N/2-3060]);xlabel('k(Hz)');ylabel('|X[k]|(db)');

PartBSimulationUsingSIMULINKINTRODUCTIONTheobjectiveofthislaboratoryistolearnaboutvariouspropertiesofsignalsandsystemsbydoingsimulationsinSIMULINK.PART1.BASICSOFSIMULINK1.1UNDERSTANDINGSIMPLEWAVEFORMSANDINTEGRATIONCreateapulseofheight2unitsfromtime0to4secondsbysubtractingtwounitstepsandaddingagain.Connectthispulsetoanintegratorwithagainof0.5andazeroinitialcondition.Connectoscilloscopestoshowthepulseandtheoutputoftheintegrator.Youmaywishtonameyoursimulation(block)diagram;todosousethesaveasfeatureunderedit.Yourblockdiagramshouldbesimilarasbelow.uBeforesimulatingyouneedtopulldownthesimulationheaderanddoubleclickonparameters.Unlesstoldotherwisealwaysassumethatyoucanusetheode45integrationalgorithmshowninthiswindowandtheotherdefaultparameters.Typicallyyouwillonlyalterthestartandstoptimesbutforthisfirstsimulationyoucanusethedefaultvaluesof0and10seconds.Doubleclickontheoscilloscopestogetthewindowsinwhichthetraceswillappear,pulldownthesimulatemenuandclickonrun.Plotbelowtheintegratorinputandoutputwaveforms.Repeattheexperimentbutwithaninitialconditionof–2ontheintegrator.Againdrawtheresults.1.2FIRSTORDERSYSTEMAsingletimeconstantmaybesimulatedusingthetransferfunctionblockinwhichyouenterthecoefficientsofthenumeratoranddenominatorpolynomials.SetuptheconfigurationinanewSIMULINKwindowtorealisethetransferfunction1/(s+2)withtheinputunitstepandanoscilloscopeconnectedtotheoutputofthetransferfunctionblock.Plottheblockdiagraminthespacebelow.Simulatethesystemfor5secondsandplottheresponse.1.3SECONDORDERSYSTEMForthesecondorderallpoletransferfunctionyouwillrecallthatifatimescaleofω0tisusedforplottingthestepresponse,theresponseshapewillonlybeaffectedbychangesinthedampingratioζ.Thiscanalsobeshownifwenormalisethetransferfunctionbyreplacing(s/ω0)bysntogive.Tostudytheeffectofvaryingζonthestepresponsewewillthereforeusethetransferfunction1/(s2+2ζs+1).Setupthefollowingconfigurationforasimulationstudy.Aunitstepinput.Connecttheunitsteptoatransferfunctionof1/(s2+2ζs+1)withζ=1.0.Takeasummingblockandconnecttheinputsteptoa+veinputandthetransferfunctionoutputtoa–veinput.Connecttheoutputofthissummertoasquarefunction.Thisisobtainedbyusingf(u)inthenonlinearblocks.Connecttheoutputofthissquarertoanintegrator.Connecttwooscilloscopestothecircuit,onetothetransferfunctionoutputandtheothertotheoutputoftheintegrator.Alsoconnectsimoutblockstothesamesignalsastheoscilloscopes.Renametheoneconnectedtotheintegratoroutputsimout1.Simulatethesystemwiththevaluesofζlistedinthetablebelowandfillintheotherfiguresfromthesimulationresults.Togetanaccuratevalueattheendofeachrunyoucantypesimout1intheMATLABwindow.Youcanalsomeasuretheovershootbymakinguseofthemaximumcommand:simplytypemax(simout)intheMATLABwindow.Table1ζ2.01.01%overshoot2.10761.25001.17781.05711.00001.12852.14313.9651home_work_3_B_1_3.slxwhenζ=1.0:PART2.SIMULATIONOFAIRCRAFTPITCHANGLEANDALTITUTE【pitch:倾斜】

ThepurposeIStouse"SIMULINK"tosimulatea(muchsimplified)modelofthelongitudinalmotionofafighteraircraft.The"angleofattack",istheanglebetweenthedirectionaplaneispointing,andthedirectioninwhichitactuallymovesthroughtheair.Foraplaneflyingatapproximatelyconstantaltitude,thisisequivalenttothe"pitchangle",,asillustratedinFig.2.1.Thisangleisimportantbecauseitproducesaliftforceperpendicular【垂直地】totheaxisoftheplane,andhencea"normalacceleration",,(alsoshowninthefigure).Fig2.1.SchematicofaircraftattitudeThepilotwantstobeabletocontrolthepitchangle,anddoessoultimatelybyrotatingthefrontfins,andtailelevatorsoftheaircraft,showninFig.2.2.Thefirsttaskisthereforetomodeltheeffectofthesemovementsonthe"pitchrate",and"normalacceleration".Fig.2.2Illustrationofcontrolsurfaces

2.1:ModellingtheAircraftandActuatorDynamicsi) NormalAcceleration,

Theaccelerationoftheaircraftinadirectionperpendiculartoitsaxis,(the"normalaccel.",),isdeterminedmainlybytheangleofthetailelevatorsoftheaircraftshowninFig.2.2.Indeedaerodynamicmodellingshowsthatthisrelationshipcanbedescribedbythedifferentialequation,Convertthisrelationshipintoatransferfunctionform:- 转移函数:(1)

ii) PitchRate,q

Therateatwhichthepitchanglechanges,(the"pitchrate",q),isdeterminedmainlybytheangleofthefrontfinsoftheaircraftshowninFig.2.2.Indeedaerodynamicmodellingshowsthatthisrelationshipcanbedescribedbythedifferentialequation,Convertthisrelationshipintoatransferfunctionform:- 转移函数:(2)

iii) ActuatorDynamics+Gears【齿轮】

Thetailelevatorsoftheaircraftaredrivendirectlybyahydraulicactuatorwhichhasatransferfunction, (3)ToaunitstepinputU(s)=1/s,theresponseR(s)=G(s)U(s)=.Whatformofstepresponser(t)wouldyouexpectfromthisactuator,andwhatisitstimeconstant? 进行L.T.,得:Thefrontfinsandthetailelevatorsarebothdrivenfromtheactuatorbythesamedriveshaftthroughagearbox.Thesamegearonthisdriveshaftconnectstothetailelevatorgearwheel,whichhas500teeth,andthefrontfingearwheel,whichhas100teeth,therelationshipbetween1and2is (4)2.2:SimulatingtheAircraftandActuatorDynamics

i)FortheaircraftmodelyouwillneedfromtheContinuousorMathsLibrary:-aTransferFcnblocktorepresentthe"tailelevatorangleSYMBOL174\f"Symbol"normalaccel"relationship(eqn

(1))aTransferFcnblocktorepresent"frontfinangleSYMBOL174\f"Symbol"pitchrate"relationship,(seeeqn(2))aTransferFcnblocktorepresentthehydraulic【液压的】"actuatordynamics",(seeeqn(3))aGainblocktorepresentthe"gears",(seeeqn(4))fromtheSourcesLibrary:-aStepInputblocktoactasatestinput-(setSteptime=5sec,andFinalvalue=0.01rad)fromtheSinksLibrary:-a‘Scopeblocktomonitorthepitchrateoutput-(setHorizontalRange=20sec).ii)Nowconnecttheblockstogether,usingthestepinputtodrivetheactuator,andtheactuatortodrivethetailelevators.Theactuatorisalsousedtodrivethefrontfinsviathegearbox.The'Scopeshouldbeconnectedtotheoutputofthe"frontfinangleSYMBOL174\f"Symbol"pitchrate"block.Note:youcantakeabranchfromasignallinebydraggingwiththerightmousebuttonfromthepointonthelineatwhichyouwantthebranchtostart.Plottheblockdiagramyouhavecreatedintheboxbelow:-

iii)Fromthepull-downmenusofyoursimulationwindow,selectSimulation/Parameters,inordertodefinehowthesimulationistobeperformed.Set:StopTime=20sec;InitialStepSize=0.001;MaxStepSize=0.01;iv)Finallydoubleclickonyour‘scope,sothatyoucanwatchtheprogressofthesimulation,andthenselectSimulation/Startfromthepull-downmenuofyoursimulationwindow.YoumaywanttoadjusttheVerticalRangeofyour'Scope,andre-runthesimulationtogetagoodpicture.Plottheresponseoftheaircraftpitchratebelow,andcommentontheseresults.Notethatitcanbeshownthatifatransferfunctionhasadenominatorpolynomial【分母多项式】withazeroornegativecoefficientthenitmusthavearootwithazeroorpositiverealpart.Plotofpitchrateresponse,toastepchangeincontrolinput:testinputtestinputthefrontfinsthetailelevatorsthefrontfinsthetailelevatorsCommentsonresponse:-(Wouldyouflythisplane?Whatdotheresultsmeanphysically?)

2.3:SIMULATINGTHEPITCHRATECONTROLSYSTEM

Thedesignersarequitegladtheysimulatedtheresponseoftheaircraft,beforetryingitforreal.Theynowdecidetoimprovetheresponsebymeasuringtheoutput(ie.whatisactuallyhappeningtothepitchrate),andsubtractingthisfromtheinput(ie.whattheywouldliketohappen),toproduceanerrorsignal.Theerrorsignalwillbeamplified,andthenusedtodrivetheactuator(seeFig.2.3).Inthiswaytheactuatorwillautomaticallyactsoastoreduceanydifferencesbetweentheinputdemand,andtheoutputresponse.

Fig.2.3Feedbackcontrolofpitchratei)Beforeyousimulatethecontrolsystemdescribedabove,youwillprobablyfindthatyouareshortofspaceinyoursimulationwindow.Besidesitwouldbenicetopackagetheaircraft+actuatordynamicsasasingleblock,sothattheyaredistinctfromanythingaddedlaterasshowninFig.2.3.Ifyoupresstheleftmousebuttoninanemptyspaceofthewindow,yougeta"rubberband"boxwhichyoucandragtosurroundagroupofelements.Whenyoureleasethebutton,allelementsinsideare"selected".Usethistechniquetoselectalltheaircraft+actuatordynamics,(butleaveoutthestepinputand‘scopemonitor).Fromthepull-downmenuunderEditselectCreateaSubsystem,andyourdiagramwillsuddenlylookasshowninFig.2.4.Fig.2.4Newdiagramii)Renamethe"Subsystem"as"Actuator+AircraftDynamics"asshowninFig.2.3byeditingthetextbelowtheblock.Youcanseewhatisinsidebydoubleclickingontheblockitself,-tryit!Noticethattheinputandoutputconnectionsarelabelled"in_1","out_1"etc.Editthesetogivethemmoremeaningfulnames.iii)Nowconstructtheplannedcontrolsystem,asillustratedinFig.2.3.NoticethepilotisnowrepresentedbyaSignalGenerator(fromtheSourceslibrary),whichshouldbesettoproduceaSquareWave,offrequency0.1Hzandpeakamplitude0.5.iv)ThedesignersareunsurewhatvaluetousefortheGain.OpenthePitchRate'Scope,andrunthesimulationfirstfortheGain=-0.5(asshownabove),andthenfortheGain=-5.Plotthetworesponsesyouobtain,andcommentontherelativeadvantagesanddisadvantagesofeach:-Plotofpitchrateresponse,toasquarewaveincontrolinput:-(a)withGain=-0.5(b)withGain=-5

Commentsonresponses(intermsofovershotandresponsetimeetc):PART3:SIMILATIONOFNONLINEARSHIPROLLDYNAMICS

Therollingmotionofshipsisofconsiderableinteresttonavalarchitectsbecauseeventodayaround50%ofshipslostatsea,sinkasaresultofacapsize.Theaimofthislaboratoryistostudysuchbehaviourby:-SYMBOL183\f"Symbol"\s10\h constructinganonlineardifferentialequationmodelforthesystemSYMBOL183\f"Symbol"\s10\h convertingthismodelintoaphasevariableblockdiagramformsuitableforsimulationSYMBOL183\f"Symbol"\s10\h simulatingthe(nonlinear)responsetosinusoidalexcitationSYMBOL183\f"Symbol"\s10\h calculatingthesteadystateresponseforashipwhosecargohasshifteddangerouslytooneside

Fig.3.1Shipschematic3.1:ModellingANDSIMULATIONOFShipDynamics

i)ConsidertheshipsketchshowninFig.3.1.Giventhat:-SYMBOL183\f"Symbol"\s10\h Theeffectiveinertia【惯性】oftheshipaboutitsrollaxis=J(1)SYMBOL183\f"Symbol"\s10\h Thedampingmoment【阻尼力矩】/torque【扭矩】duetofriction【摩擦】betweenthebodyoftheshipandthewater,andduetoturbulence【湍流】roundthe"bilgekeels"=(2) SYMBOL183\f"Symbol"\s10\h Therestoringmoment/torqueduetothebuoyancy【浮力】andshapeoftheship,asitispushedtooneside=(3)SYMBOL183\f"Symbol"\s10\h Theinput/forcingmomentduetothewaveforcesactingontheship=UsingNewton’ssecondlawofmotion,thenonlineardifferentialequationwhichdescribestherollingmotionoftheshipcanbewrittenas:- (4)(ii)Re-arrangeequation(4)toobtainanexpressionforthehighestderivativeoftheoutputsignal:- (5)iii)HencecompletethedrawingoftheSIMULINKblockdiagramfortheshiprollsystem:-

3.2:SimulatingtheSHIPDYNAMICS

i) Fortheshipmodelyouwillneed:-fromtheContinuousandMathsLibrary:- SYMBOL183\f"Symbol"\s10\h afewIntegratorblocks-(assumezeroinitialconditionsfornow) SYMBOL183\f"Symbol"\s10\h afewGainblocks(notabsolutelynecessary) fromtheNonlinearLibrary:- SYMBOL183\f"Symbol"\s10\h acoupleofFcnblockstoimplementthedampingandstiffnessterms(eqns(2),and(3))fromtheSourcesLibrary:- SYMBOL183\f"Symbol"\s10\h aSineWaveblocktosimulatetheseawavesu(t)-(setAmpl=0.3,andFreq=0.6rad/s)fromtheSinksLibrary:-SYMBOL183\f"Symbol"\s10\h aToWorkspaceblockfortheoutputshiprollangle,SYMBOL113\f"Symbol",ofthesimulation.ThisstorestheresultsinaMATLABvariablewhichwecanplotlater,-(settheVariablename=theta,andtheMaximumnumberoftimesteps(iepointsstored)=5000)anoscilloscopeifyouwishtoseeawaveformwhilstthesimulationistakingplaceii)Dragtheappropriateblocksoverintoyoursimulationwindowusingthemouse,anddoubleclickonthemtoentertheappropriateparametervalues.Thenumericalvaluesforthecoefficientsofeqn(4)are:- (6)Notethesevaluesaregiveninconsistentunitssothatθisinradians【弧度】.Finallybyclickingonthetextunderea

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论