资源描述:
《MATLAB机考样题带答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、MATLAB机考样题:n=-20:20;x1=2*cos(pi/8*n);subplot(2,1,1)stem(n,x1);subplot(2,1,2)stem(n+4,x1);(1)Generateandplotsequence,with.n1=-20:20;x1=2*cos(pi/8*n1)n2=n1-4;x2=2*cos(pi/8*n2)subplot(211)plot(n1,x1);subplot(212)plot(n2,x2)?(2)WriteaMATLABprogramtocomputeandplo
2、ttheimpulseresponseofacausalfinite-dimensionaldiscrete-timesystemcharacterizedbyadifferenceequationofthefollowingform:N=input('inputthepointsyouwant:');num=[1.80.34-1.32-0.86];den=[10.30.5-0.72];[H,w]=freqz(num,den,N);%计算frequencyresponsesubplot(2,1,1)plot(w
3、/pi,abs(H));title('magnituderesponse');subplot(2,1,2)plot(w/pi,angle(H));title('phaseresponse');N=input('请输入你要求的点数N=');num=[1.80.34-1.32-0.86];den=[10.30.5-0.72];x=[1zeros(1,N-1)];y=filter(num,den,x)plot(0:N-1,y)num=[8.16.93-23.8210.5];den=[11.520.18-0.1768]
4、;[z,p,k]=tf2zp(num,den)zplane(z,p);[sos,G]=tf2sos(num,den)(3)WriteaMATLABprogramtocomputeanddisplaythepolesandzeros,tocomputeanddisplaythesecond-orderfactoredform,andtogeneratethepole-zeroplotofaz-transformthatisaratiooftwopolynomialsinz-1.Usingthisprogramto
5、analyzethefollowingG(z):num=[8.16.93-23.8210.5];den=[11.520.18-0.1768];sos=tf2sos(num,den)zplane(num,den)(4)TrytogiveaprogramtoevaluatethefollowingDTFTintherange:%由于用freqz计算频点至少是2个,所以至少输入两个频点w1=input('请输入你要计算的频点w1=');w2=input('请输入你要计算的频点w2=');w=[w1w2];num=[2
6、5953];den=[545211];h=freqz(num,den,w)N=input('inputthepointsyouwanttocompute:');num=[25953];den=[545211];[h,w]=freqz(num,den,N);subplot(2,2,1)plot(w/pi,real(h));gridtitle('Realpart')xlabel('omega/pi');ylabel('Amplitude')subplot(2,2,2)plot(w/pi,imag(h));gri
7、dtitle('Imaginarypart')xlabel('omega/pi');ylabel('Amplitude')subplot(2,2,3)plot(w/pi,abs(h));gridtitle('MagnitudeSpectrum')xlabel('omega/pi');ylabel('Magnitude')subplot(2,2,4)plot(w/pi,angle(h));gridtitle('PhaseSpectrum')xlabel('omega/pi');ylabel('Phas
8、e,radians')(6)WriteaMATLABprogramtocomputeandplotthemagnituderesponseofacausalLTIdiscrete-timesystemwithatransferfunctiongivenbynum=[0.150-0.15];den=[1-0.50.7];[h,w]=freqz(num,den);plot(w/pi,h)n