控制系统仿真(MATLAB)实验1-6_第1页
控制系统仿真(MATLAB)实验1-6_第2页
控制系统仿真(MATLAB)实验1-6_第3页
控制系统仿真(MATLAB)实验1-6_第4页
控制系统仿真(MATLAB)实验1-6_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

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

文档简介

控制系统仿真(MATLAB)实验指导书青岛大学自动化工程学院2006年4月一、实验目的:BefamiliarwithMATLABEnvironmentBefamiliarwitharrayandmatrixBefamiliarwithMATLABoperationsandsimpleplotfunction二、实验内容:BefamiliarwithMatlab6.5StartupMatlab6.5,browsethemajortoolsoftheMatlabdesktopTheCommandWindowsTheCommandHistoryWindowsLaunchPadTheEdit/DebugWindowFigureWindowsWorkspaceBrowserandArrayEditerHelpBrowserCurrentDirectoryBrowserGivetheanswerofthefollowingquestionsforthearray1.10.02.1-3.5array}-0.01.1-6.6 2.80.3-0.4—1.40.01.16.01.10.02.1-3.5array}-0.01.1-6.6 2.80.3-0.4—1.40.01.16.03.41.30.0_Whatisthesizeofarray1?Whatisthevalueofarray1(4,1)?Whatisthesizeandvalueofarray1(:,1:2)?Whatisthesizeandvalueofarray1([13],end)?Givetheanswerofthefollowingcommadl)a=l:2:5; 2)b=0a9a5];3)c=b(l:2:3,1:2:3);4)d=a+b(2,:)5)w=[zeros(l,3)ones(3,l)93:51Givetheanswerofthesub-arrays-6.62.83.40.3-0.41.3-6.62.83.40.3-0.41.30.01.10.00.01.1array}=2.10.1-1.45.11)array1(3,:);2)array1(:,3);3)array1(1:2:3,[334])4)arrayl([l1],:)Givetheanswerofthefollowingoperations2 -21ri-iirii,b= ,c-,d=eye(2)-12jL02J2_4)a*c

8)a.A4)a*c

8)a.Aba.*c 6)a\b 7)a.\bSolvethefollowingsystemofsimultaneousequationsforx—2.0X1+5.0x2+1.0尤3+3・014+4.0/-1.0x6—0.02.Ox,-1.0x2-5.0x3-2.0x4+6.0x5+4.0x6=1.0—1.0X1+6.0^2—4.0%3—5.0%4+3.0/一1・04=—6.0—4.0%]+3・0%2-6.0兄3—5.0%4—2.0%5—2.0%6=10.0—3.0%+6.0x?+4.0元3+2.0%4—6.0天+4・04=—6.02.0%+4.0%2+4.0工3+4.0工4+5.0/一4.0x6=~2.0Edit&Runthem-file%teststepresponsefunctionwn=6;kosi=[0.1:0.1:1.02];figure(l);holdonforkos=kosinum=wnA2;den=[l,2*kos*wn,wn.A2];step(num,den)endholdoff;Edit&Runthem-file%testplotfunctionx=0:pi/20:3*pi;yl=sin(x);y2=2*cos(2*x);plot(x,yl/rv:\x,y2/bo—1);title('PlottheLineofy=sin(2x)anditsderivative');xlabelfXaxis1);ylabel(!Yaxis');legend(*f(x)Vd/dxf(x),);gridon;Edit&Runthem-file%testsubplotandloglogfunctionx=0:0.1:10;y=x.A2-l0.*x+26;subplot(2,2,l);plot(x,y);gridon;subplot(2,2,2);semilogx(x,y);gridon;subplot(2,2,3);semilogy(x,y);gridon;subplot(2,2,4);loglog(x,y);gridon;Edit&Runthem-file%testmaxandplotfunctionvolts=120;rs=50;rl=l:0.1:100;amps=volts./(rs+rl);pl=(amps.A2).*rl;[maxvol,index]=max(pl);plot(rl,pl,rl(index),pl(index),,rh,);gridon;一、实验目的:LearntodesignbranchandloopstatementsprogramBefamiliarwithrelationalandlogicaloperatorsPractice2Dplotting二、实验内容:PARTI:(选择练习,不需提交实验报告)Holdcommandexercisex=-pi:pi/20:pi;yl=sin(x);y2=cos(x);plot(x,yl,,b,);holdon;plot(x,y2,'k--');holdoff;legend('sinx',‘cosx')Figurecommandexercisefigure(l);subplot(2,l,l);x-pi:pi/20:pi;y=sin(x);plot(x,y);grsidon;titleC^ubplot1Title1);subplot(2,l,2);x-pi:pi/20:pi;y=cos(x);plot(x,y);gridon;titleC^ubplot2Title1);PolarPlotsexerciseg=0.5;theta=0:pi/20:2*pi;gain=2*g*(1+cos(theta));polar(theta,gain,'r-f);title('\fontsize{20}\bfGainversusangle\theta1);Comparethe3approachesfollows(LoopsandVectorization)%A.PerformcalculationbyForLoopwithpre-initializearraytic;square=zeros(l,l0000)%pre-initializearrayforii=l:10000square(ii)=iiA2;square_root(ii)=iiA(1/2);cube_root(ii)=iiA(l/3);endtoe;tl=toc%B.PerformcalculationbyForLoopwithoutpre-initializearraytic;forii=1:10000square(ii)=iiA2;square_root(ii)=iiA(1/2);cube_root(ii)=iiA(l/3);endtoe;t2=toc%C.Performcalculationwithvectorstic;ii=1:10000square(ii)=ii.A2;square_root(ii)=ii.A(1/2);cube_root(ii)=ii.A(l/3);endtoe;t3=tocPARTII:(需提交实验报告)Assumethata,b,c,anddaredefined,andevaluatethefollowingexpression.a=20;b=-2;c=0;d=l;a>b;(2)b>d;(3)a>b&c>d;(4)a==b;(5)a&b>c;6)〜〜b;a=2;b=[l-2;-010];c=[01;20];d=[-212;010];(7)〜(a〉b)(8)a>c&b>c(9)c<=da=2;b=3;c=10;d=0;a*b八2〉a*c(11)d|b>a(12)(d|b)>aa=20;b=-2;c=0;d=9Tesf;isinf(a/b)(14)isinf(a/c)(15)a>b&ischar(d)(16)isempty(c)WriteaMatlabprogramtosolvethefunctiony(x)=In---,wherexisanumber<1.Useanif\-xstructuretoverifythatthevaluepassedtotheprogramislegal.Ifthevalueofxislegal,caculatey(x).Ifnot,writeasuitableerrormessageandquit.Writeoutm.fileandplotthefigureswithgridsAssumethatthecomplexfunctionf(t)isdefinedbytheequationf(t)=(0.5-0.25i)t-1.0Plottheamplitudeandphaseoffunctionfor0<f<4.WritetheMatlabstatementsrequiredtocalculatey(t)fromtheequation1—3/2+5/NOM="/<oforvalueoftbetween-9and9instepsof0.5.

温馨提示

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

评论

0/150

提交评论