資源描述:
《matlab上機(jī)作業(yè)4》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、●高等數(shù)學(xué)1.在Matlab中,一階微分方程能夠很方便的得到數(shù)值解,對(duì)于高階微分方程,可以轉(zhuǎn)化為一階常微分方程進(jìn)行求解,例如,一個(gè)n階微分方程y(n)=f(t,y',y",...,y(n-1))設(shè),可將上式化為一階方程組對(duì)上述一階方程組求解,即可求得高階微分方程的解。要求:完成一個(gè)圖形界面程序,試求解二階微分方程y''(t)=-6cos(2t)+3sin(t)+t-11.5的數(shù)值解,并將數(shù)值解和解析畫(huà)在同一圖形窗口中進(jìn)行比較,對(duì)圖形進(jìn)行標(biāo)識(shí),能夠在界面輸入自定義的初值和時(shí)間范圍。(可用ode23或ode45)hf=figure(...'Units','Normalized',...'Men
2、u','none',...'Color','w',...'Position',[0.10.10.70.5]);ha=axes(...'Parent',hf,...'Units','Normalized',...'Position',[0.10.10.60.8],...'Nextplot','Add');hb1=uicontrol(...'Style','pushbutton',...'Callback','try,delete(allchild(ha));end',...'String','clear',...'Units','Normalized',...'Position',[0.80
3、.20.20.15]);y=dsolve('D2y=-6*cos(2*t)+3*sin(t)+t-11.5','y(0)=0','Dy(0)=0');hb2=uicontrol(...'Style','pushbutton',...'Callback','ezplot(y)',...'String','?a???a',...'Units','Normalized',...'Position',[0.80.40.20.15]);functiony=odefun(t,x)y=zeros(2,1);y(1)=x(2);y(2)=-6*cos(2*t)+3*sin(t)+t-11.5;hb3=ui
4、control(...'Style','pushbutton',...'String','êy?μ?a',...'Callback','',...'Units','Normalized',...'Position',[0.80.60.20.15]);●信號(hào)處理2.數(shù)據(jù)文件xinhao001.mat為某次試驗(yàn)采集到的試驗(yàn)結(jié)果,已知采樣頻率為1000Hz,設(shè)計(jì)一個(gè)濾波器,從試驗(yàn)結(jié)果中提取出截止頻率分別在5、10、50、100Hz以下的測(cè)量信號(hào)。注:數(shù)據(jù)文件xinhao001.mat中,變量t為時(shí)間;變量y為測(cè)量信號(hào)。要求:設(shè)計(jì)一個(gè)圖形界面,選擇或輸入截止頻率,然后在不同窗口中分別繪制出當(dāng)前截止
5、頻率下原信號(hào)和濾波后的信號(hào)的圖形及其各自的頻譜圖。functionvarargout=xinhao(varargin)gui_Singleton=1;gui_State=struct('gui_Name',mfilename,...'gui_Singleton',gui_Singleton,...'gui_OpeningFcn',@xinhao_OpeningFcn,...'gui_OutputFcn',@xinhao_OutputFcn,...'gui_LayoutFcn',[],...'gui_Callback',[]);ifnargin&&ischar(varargin{1})gui
6、_State.gui_Callback=str2func(varargin{1});endifnargout[varargout{1:nargout}]=gui_mainfcn(gui_State,varargin{:});elsegui_mainfcn(gui_State,varargin{:});endfunctionxinhao_OpeningFcn(hObject,eventdata,handles,varargin)handles.output=hObject;guidata(hObject,handles);functionvarargout=xinhao_OutputFcn(
7、hObject,eventdata,handles)varargout{1}=handles.output;functionedit1_Callback(hObject,eventdata,handles)functionedit1_CreateFcn(hObject,eventdata,handles)ifispc&&isequal(get(hObject,'BackgroundColor'),get(0,'defau