厦门大学物理与机电工程小学期matlab作业5Word格式文档下载.docx
- 文档编号:20316056
- 上传时间:2023-01-21
- 格式:DOCX
- 页数:20
- 大小:30.44KB
厦门大学物理与机电工程小学期matlab作业5Word格式文档下载.docx
《厦门大学物理与机电工程小学期matlab作业5Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《厦门大学物理与机电工程小学期matlab作业5Word格式文档下载.docx(20页珍藏版)》请在冰豆网上搜索。
2^(1/x)-(5*x^2)/(x^2-1)
y2=
-4
-4.0
2、求下列幂级数的和函数
(2)
symsxn
f1=(-1)^n*x^2/sqrt(n^2-n)
y1=symsum(f1,n,2,inf)
f2=(-1)^n*sin(pi/2^n)*x^2
y2=symsum(f2,n,2,inf)
((-1)^n*x^2)/(n^2-n)^(1/2)
x^2*sum((-1)^n/(n^2-n)^(1/2),n=2..Inf)
0.46344818868644238039448964554004*x^2
(-1)^n*x^2*sin(pi/2^n)
x^2*sum((-1)^n*(((1/exp((pi*i)/exp(n*log
(2))))*i)/2-(exp((pi*i)/exp(n*log
(2)))*i)/2),n=2..Inf)
x^2*(9.1835496157991211560057541970488*10^(-41)*i+0.45420393338822847241557667883)
3、求下列函数的导数
symsx
f1=x^10+10^x+log(10)/log(x)
dy1=diff(f1)
f2=4^(sin(x))
dy2=diff(f2)
2592480341699211/(1125899906842624*log(x))+10^x+x^10
dy1=
10^x*log(10)-2592480341699211/(1125899906842624*x*log(x)^2)+10*x^9
4^sin(x)
dy2=
4^sin(x)*log(4)*cos(x)
4、计算下列定积分。
())
symsx
f1=x*log(x)
y1=int(f1,1,exp
(1))
f2=sqrt(sin(x)^3-sin(x)^5)
y2=int(f2,0,pi)
x*log(x)
(9366741398929500034245406117369*log(3060513257434037/1125899906842624))/2535301200456458802993406410752-8099090798701270632748702911993/5070602400912917605986812821504
.0972********
(sin(x)^3-sin(x)^5)^(1/2)
4/5
0.8
5、以根据
,求
的近似值。
当n分别取100,1000,10000时,结果是多少?
symsn
f=1/n^2;
PI=vpa(sqrt(symsum(f,1,inf)*6))
PI_100=vpa(sqrt(symsum(f,1,100)*6))
PI_1000=vpa(sqrt(symsum(f,1,1000)*6))
PI_10000=vpa(sqrt(symsum(f,1,10000)*6))
PI=
3.1415926535897932384626433832795
PI_100=
3.132********91059044445112609662
PI_1000=
3.1406380562059931230088735472239
PI_10000=
3.1414971639472092031520459032364
6、MATLAB窗体和菜单设计
(1)菜单下有File(文件)菜单项和用于绘图参数选择的菜单项Option(选项)。
(2)File下有New(新建),Plot(绘图)和Exit(退出)3个选项。
(3)选择New时建立一个新的M文件。
(4)选择Plot将显示下一级菜单,其中有SinWave(Sin曲线)和CosWave(Cos曲线)两个子菜单。
曲线的横坐标取值范围为负的学号最后一位*pi~正的学号最后一位*pi。
假设学号最后一位为3,则曲线横坐标范围为[-3,3];
若学号最后一位为0,则取10,即[-10,10]
(5)曲线的纵坐标需再加上随机值:
y=sin(x)+rand(size(x))
(6)Option下面包含3个选项:
LineStyle(线型),Marker(符号)和Color(颜色),每个选项包含若干个子项分布可以选择图线的类型、标记点的类型和颜色。
(7)菜单选项点击后要有相应的操作,即在窗体上画出sine或cosine曲线,并能改变曲线属性。
(8)除了将程序代码复制粘贴到文档的代码表格内外,还需要把程序代码源文件(.m文件)和GUI窗口文件(.fig文件)一并提交。
同时告知所用的MATLAB版本,因为不同版本的fig文件可能不兼容。
functionvarargout=GuiText(varargin)
%GUITEXTM-fileforGuiText.fig
%GUITEXT,byitself,createsanewGUITEXTorraisestheexisting
%singleton*.
%
%H=GUITEXTreturnsthehandletoanewGUITEXTorthehandleto
%theexistingsingleton*.
%GUITEXT('
CALLBACK'
hObject,eventData,handles,...)callsthelocal
%functionnamedCALLBACKinGUITEXT.Mwiththegiveninputarguments.
Property'
'
Value'
...)createsanewGUITEXTorraisesthe
%existingsingleton*.Startingfromtheleft,propertyvaluepairsare
%appliedtotheGUIbeforeGuiText_OpeningFcngetscalled.An
%unrecognizedpropertynameorinvalidvaluemakespropertyapplication
%stop.AllinputsarepassedtoGuiText_OpeningFcnviavarargin.
%*SeeGUIOptionsonGUIDE'
sToolsmenu.Choose"
GUIallowsonlyone
%instancetorun(singleton)"
.
%Seealso:
GUIDE,GUIDATA,GUIHANDLES
%EdittheabovetexttomodifytheresponsetohelpGuiText
%LastModifiedbyGUIDEv2.521-Jul-201520:
11:
12
%Begininitializationcode-DONOTEDIT
gui_Singleton=1;
gui_State=struct('
gui_Name'
mfilename,...
'
gui_Singleton'
gui_Singleton,...
gui_OpeningFcn'
@GuiText_OpeningFcn,...
gui_OutputFcn'
@GuiText_OutputFcn,...
gui_LayoutFcn'
[],...
gui_Callback'
[]);
ifnargin&
&
ischar(varargin{1})
gui_State.gui_Callback=str2func(varargin{1});
end
ifnargout
[varargout{1:
nargout}]=gui_mainfcn(gui_State,varargin{:
});
else
gui_mainfcn(gui_State,varargin{:
%Endinitializationcode-DONOTEDIT
%---ExecutesjustbeforeGuiTextismadevisible.
functionGuiText_OpeningFcn(hObject,eventdata,handles,varargin)
%Thisfunctionhasnooutputargs,seeOutputFcn.
%hObjecthandletofigure
%eventdatareserved-tobedefinedinafutureversionofMATLAB
%handlesstructurewithhandlesanduserdata(seeGUIDATA)
%varargincommandlineargumentstoGuiText(seeVARARGIN)
%ChoosedefaultcommandlineoutputforGuiText
handles.output=hObject;
%Updatehandlesstructure
guidata(hObject,handles);
%UIWAITmakesGuiTextwaitforuserresponse(seeUIRESUME)
%uiwait(handles.figure1);
%---Outputsfromthisfunctionarereturnedtothecommandline.
functionvarargout=GuiText_OutputFcn(hObject,eventdata,handles)
%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);
%Getdefaultcommandlineoutputfromhandlesstructure
varargout{1}=handles.output;
%--------------------------------------------------------------------
functionFile_Callback(hObject,eventdata,handles)
%hObjecthandletoFile(seeGCBO)
functionOption_Callback(hObject,eventdata,handles)
%hObjecthandletoOption(seeGCBO)
functionLineStyle_Callback(hObject,eventdata,handles)
%hObjecthandletoLineStyle(seeGCBO)
functionMarker_Callback(hObject,eventdata,handles)
%hObjecthandletoMarker(seeGCBO)
functionColor_Callback(hObject,eventdata,handles)
%hObjecthandletoColor(seeGCBO)
functionNew_Callback(hObject,eventdata,handles)
%hObjecthandletoNew(seeGCBO)
edit;
functionPlot_Callback(hObject,eventdata,handles)
%hObjecthandletoPlot(seeGCBO)
functionExit_Callback(hObject,eventdata,handles)
%hObjecthandletoExit(seeGCBO)
selection=questdlg(['
close'
get(handles.figure1,'
Name'
)'
?
'
...
...'
Yes'
'
No'
]);
ifstrcmp(selection,'
)
return;
delete(handels.figure1)
functionSin_Wave_Callback(hObject,eventdata,handles)
%hObjecthandletoSin_Wave(seeGCBO)
x=[-5:
0.1:
5]*pi;
h=plot(x,sin(x)+0.2*rand(size(x)));
axis([-5*pi5*pi-1.51.5])
h=findobj('
Type'
Line'
);
set(gca,'
xtick'
[-5:
5]*pi);
xticklabel'
{'
-5pi'
-4pi'
-3pi'
-2pi'
-pi'
0'
pi'
2pi'
3pi'
4pi'
5pi'
functionCos_Wave_Callback(hObject,eventdata,handles)
%hObjecthandletoCos_Wave(seeGCBO)
h=plot(x,cos(x)+0.2*rand(size(x)));
%---Executesonslidermovement.
functionslider2_Callback(hObject,eventdata,handles)
%hObjecthandletoslider2(seeGCBO)
%Hints:
get(hObject,'
)returnspositionofslider
%get(hObject,'
Min'
)andget(hObject,'
Max'
)todeterminerangeofslider
%---Executesduringobjectcreation,aftersettingallproperties.
functionslider2_CreateFcn(hObject,eventdata,handles)
%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled
%Hint:
slidercontrolsusuallyhavealightgraybackground.
i
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 厦门大学 物理 机电工程 小学 matlab 作业