资源描述:
《MATLAB 第五次上机实验报告.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、MATLAB第五次上机实验报告Quit3.31题%calculatexversusy1andy2x=0:pi/10:2*pi;y1=sin(x);y2=cos(2*x);%ploty1andy2;plot(x,y1,'-ro','LineWidth',2,'MarkerSize',6,'MarkerEdgeColor','b','MarkerFaceColor','b')holdonplot(x,y2,'-ro','LineWidth',2,'MarkerSize',6,'MarkerEdgeColor','b','MarkerFaceColor','b')holdoffleg
2、end('sinx','cosx')2题WritetheMATLABtextstringthatwillproducethefollowingexpressions3题f(x)=sinθcos2фAnswer:it{f}(x)=sinthetacos2phi4题4.PlotofΣx^2versusxAnswer:plotofSigmax^2versusxWritetheexpressionproducedbythefollowingtextsting:5题‘tauit_{m}’Answer:6题'bfitx_{1}^{2}+x_{2}^{2}rm(units:
3、bfm^{2}rm)'Answer:7题howdoyoudisplaythebackslash()characterinatextstring?Answer:\3.8题%theta--Anglefrommicrophoneaxis(radians)%g--Afunctionofangle%Calculatgversusangletheta=-pi/2:pi/20:pi/2;g=abs(sinc(4*theta));%plotgpolar(theta,g,'b-');title('bfAntennaGainvstheta')3.11题%definevariables:
4、%amp--Amplituderesponse%c--Capacitance(farads)%f--frequencyofinputsignal(Hz)%phase--phaseresponse%r--resistance(ohms)%res--v0/ui%Initializer&cr=16000;%16kohmsc=1e-6;%1uff=1:2:1000;%calculateresponseres=(j*2*pi*f*r*c)./(1+j*2*pi*f*r*c);amp=abs(res);phase=angle(res);%createplotssubplot(2,1,1);
5、%Createplotssubplot(2,1,1);loglog(f,amp);title('AmplitudeResponse');xlabel('Frequency(Hz)');ylabel('Output/InputRatio');gridon;subplot(2,1,2);semilogx(f,phase);title('PhaseResponse');xlabel('Frequency(Hz)');ylabel('Output-InputPhase(rad)');gridon;3.12题%definevariables:%r--thedistanceofapoint
6、fromtheorigin%theta--theangleofonepointinradianswithrespecttotheorigin%k--constant%calculateresponsek=0.5;theta=0:pi/20:6*pi;r=k*theta;%plotrpolar(theta,r)title('bfTheSpiralofArchimedes')6.10题%Definevariables:%y--equaltoe^(i*theta)%theta--anglevariesfrom0to2*pitheta=0:pi/20:2*pi;y=cos(theta
7、)+i*sin(theta);subplot(2,1,1)plot(theta,y);title('bfTwo-DimensionalLinePlot');xlabel('bftheta');ylabel('bfy');subplot(2,1,2)plot3(theta,cos(theta),sin(theta));title('bfThree-DimensionalLinePlot');xlabel('bftheta');ylabel('bfcostheta');zlab