您好,欢迎访问三七文档
当前位置:首页 > 机械/制造/汽车 > 综合/其它 > 国立台湾大学机器人实验室
NationalTaiwanUniversityRoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室MATLABSignalProcessingToolbox報告日期:2009/3/11指導老師:黃漢邦教授報告者:黃子豪RoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversityOutlineTimeresponse,ConvolutionFourier,Laplace,Z-transformDTFTandFFTIIRandFIRfiltersSignalProcessingToolboxExampleFDAtoolExampleRoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity波形產生Wihtenoise---randn(t)Squarefunction---square(t)Sinc函數---sinc(t)鋸齒波---sawtooth(t)RoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity步階響應與脈衝響應差分方程式y(n)+1.2y(n-1)+0.25y(n-2)=x(n),求出在n=0時的步階響應與脈衝響應filter指令格式輸出信號(yn)=filter(輸入信號係數bm,輸出信號係數ak,輸入信號xn)NkMmmkmnxbknya00)()(RoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity步階響應與脈衝響應clear;closeall;t=-5:120;n0=0;%impulsestartingpointa=[11.20.25];%y(n)coefficientb=[1];%x(n)coefficient%stepsignalx_step=(t=n0);%impulsesignalx_imp=(t==n0);%checkresponsestp_rep=filter(b,a,x_step);imp_rep=filter(b,a,x_imp);%plotfiguresubplot(211)stem(t,x_step);xlabel('timesequence(n)');ylabel('inputsignalx');title('Stepinputsignal')subplot(212)RoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity步階響應與脈衝響應stem(t,stp_rep);line(t,zeros(1,length(t)));xlabel('timesequence(n)');ylabel('outputsignaly(n)');title('Stepresponse')figuresubplot(211)stem(t,x_imp);xlabel('timesequence');ylabel('inputsignalx');title('Impulseinputsignal')subplot(212)stem(t,imp_rep);line(t,zeros(1,length(t)));xlabel('timesequence(n)');ylabel('outputsignaly(n)');title('Impulseresponse')-2002040608010012000.51timesequence(n)inputsignalxStepinputsignal-20020406080100120-0.500.51timesequence(n)outputsignaly(n)Stepresponse-2002040608010012000.51timesequenceinputsignalxImpulseinputsignal-20020406080100120-2-1012timesequence(n)outputsignaly(n)ImpulseresponseRoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity線性摺積運算輸出性號y(n)可由將輸入訊號x(n)與系統脈衝響應T(n)作線性摺積而求得函式:c=conv(a,b)c的向量長度為length(a)+length(b)-1範例:c=conv([111],[111])c=123210)()()(kknTkxnyRoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity線性摺積運算差分方程式y(n)+1.2y(n-1)+0.25y(n-2)=x(n),x(n)=0.5u(n),求出系統的響應%CHECKlinearconvolutionANDfullresponseclear;closeall;t=-5:20;n0=0;%impulsestartingpointa=[11.20.25];%y(n)coefficientb=[1];%x(n)coefficient%stepsignalx_step=(t=n0);x_in=(0.5.^t).*x_step;%(0.5)^n*u(n)%impulsesignalx_imp=(t==n0);%impulseresponsestp_rep1=filter(b,a,x_imp);RoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity%convolutionstp_rep2=conv(x_in,stp_rep1);%輸入信號與脈衝響應的摺積%checkresponsestp_rep3=filter(b,a,x_in);%使用filter指令求出系統響應與stp_rep2的結果比較%plotfiguresubplot(211)stem(t,x_in);xlabel('timesequence(n)');ylabel('inputsignalx');title('Inputsignal')subplot(212)stem(t,stp_rep1);line(t,zeros(1,length(t)));xlabel('timesequence(n)');ylabel('impulseresponsey(n)');title('Impulseresponse')線性摺積運算RoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity線性摺積運算figuresubplot(211)stem(t,stp_rep2(6:length(t)+5));line(t,zeros(1,length(t)));xlabel('timesequence(n)');ylabel('outputsignaly(n)');title('Convolution')subplot(212)stem(t,stp_rep3);line(t,zeros(1,length(t)));xlabel('timesequence(n)');ylabel('outputsignaly(n)');title('fullresponse')-50510152000.51timesequence(n)inputsignalxInputsignal-505101520-2-1012timesequence(n)impulseresponsey(n)Impulseresponse-505101520-1-0.500.51timesequence(n)outputsignaly(n)Convolution-505101520-1-0.500.51timesequence(n)outputsignaly(n)fullresponseRoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversityFouriertransformVariablex(預設輸入變數符號),w(預設輸出變數符號)symstwRoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversityInverseFourierTransformVariablew(預設輸入變數符號),x(預設輸出變數符號)RoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity離散傅立葉轉換%sinsignalclear;closeall;w1=0.5*pi;%analoguesignalfrequencyto=1/w1;%analoguesignalperiodts=0.5*0.5*to;%samplingperiodtd=0:ts:4;%timesequencex_sin=sin(w1.*td);%fouriertransformw=0:pi/50:2*pi;fori=1:length(w)fork=1:length(x_sin);x_ff(k)=x_sin(k)*exp(-j*w(i)*k);%傅立葉轉換公式endx_f(i)=sum(x_ff(:));endnjwnjwenxex][)(RoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity離散傅立葉轉換%plotsinfiguresubplot(211)stem(td,x_sin);%plotthex-axisline(td,zeros(1,length(td)));xlabel('timesequencen');ylabel('Samplingsin(nt)');title('SamplingsignalofSin')subplot(212)plot(w/pi,abs(x_f));xlabel('piunit');ylabel('Magnitude');line(w/pi,zeros(1,length(w/pi)));title('Fouriertransformofsin')00.511.522.533.54-1-0.500.51timesequencenSamplingsin(nt)SamplingsignalofSin00.20.40.60.811.21.41.61.82051015piunitMagnitudeFouriertransformofsinRoboticsLaboratory,ME,NTU國立台灣大學機器人實驗室NationalTaiwanUniversityNationalTaiwanUniversity離散傅立葉轉換—使用fft指令FFT是一種計算DFT的方法,可降低計算時間範例:clear%時間向量與訊號產生t=(0:1/100:10-1/100);%Timevect
本文标题:国立台湾大学机器人实验室
链接地址:https://www.777doc.com/doc-45520 .html