中南大学matlab题目.doc
- 文档编号:1696290
- 上传时间:2022-10-23
- 格式:DOC
- 页数:8
- 大小:43KB
中南大学matlab题目.doc
《中南大学matlab题目.doc》由会员分享,可在线阅读,更多相关《中南大学matlab题目.doc(8页珍藏版)》请在冰豆网上搜索。
1求函数在指定点的导数值
>>symsx
>>a=[xx^2x^3;12*x3*x^2;026*x];
>>f=det(a);
>>diff(f,1)
ans=
6*x^2
>>diff(f,2)
ans=
12*x
>>diff(f,3)
ans=
12
2符号法求下列函数的导数或积分
1)y=x10+10x+logx10,求y’
f=('x^10+10^x+log(10)/log(x)')
f=
x^10+10^x+log(10)/log(x)
>>diff(f)
ans=
10*x^9+10^x*log(10)-log(10)/log(x)^2/x
2)y=ln(1+x),求y’’∣x=1
f=('log(1+x)/log(e)')
f=
log(1+x)/log(e)
>>diff(f,1,2)
ans=
-1/(1+x)^2/log(e)
3)y=ex/cosx,求y’
f=('exp(x)/cos(x)')
f=
exp(x)/cos(x)
>>diff(f)
ans=
exp(x)/cos(x)+exp(x)/cos(x)^2*sin(x)
4)
functionf=fun0(t)
f=t*sin(t)
int('fun0','0','pi')
ans=
1/2*pi^2
5)已知函数z=sin(xy),计算
symsxy
>>z=('sin(x*y)')
z=
sin(x*y)
>>diff(diff(z,y,2),x)
ans=
-cos(x*y)*y*x^2-2*sin(x*y)*x
3用数值方法求定积分
1)
functionf=fun(x)
f=x.^2.*sqrt(2.*x.^2+3)
quad('fun',1,5)
ans=
232.8057
2)
functionf=fun(x)
f=x./sin(x).^2
quad('fun',pi/4,pi/3)
ans=
0.3835
4已知数据[x,y]如下表,试求2次拟合多项式f(x),然后求x=0.05,0.25,0.45,0.65,0.85,1.05各点的函数近似值,并绘出拟合曲线及求得的函数点。
x
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0
y
-0.447
1.978
3.28
6.16
7.08
7.34
7.66
9.56
9.48
9.3
11.2
>>x=[0.00.10.20.30.40.50.60.70.80.91.0];
>>y=[-0.4471.9783.286.167.087.347.669.569.489.311.2];
>>a=polyfit(x,y,2)
a=
-9.810820.1293-0.0317
>>x0=[0.0:
0.1:
1.0];
>>y0=a(3)+a
(2).*x0+a
(1).*x0.^2;
>>plot(x,y,'*')
>>holdon
>>plot(x0,y0,'-r')
>>x1=[0.050.250.450.650.851.05];
>>y1=interp1(x0,y0,x1)
y1=
Columns1through5
0.92574.36297.01538.88289.9654
Column6
NaN
5求方程exsinx=0在区间[-4,-3]上的一个根。
x=fzero('exp(x).*sin(x)',[-4,-3])
x=
-3.1416
6已知某函数的离散点列如下
X
-4
-3
-2
-1
0
1
2
3
4
y
0.97279
3.4234
3.8186
1.8415
0
-0.15853
-0.18141
-2.5766
-7.0272
分别使用hermite插值、三次样条插值、三次方插值估算在x在2.5,1.5,0.5,-0.5,-1.5,-2.5的函数值,并在同一张图上绘制出三条曲线。
>>x0=[-4-3-2-101234];
>>y0=[0.972793.42343.81861.84150-0.15853-0.18141-2.5766-7.0272];
>>x=[-4:
1:
4];
>>y=pchip(x0,y0,x);
>>plot(x,y,'-r')
>>holdon
>>y=spline(x0,y0,x);
>>plot(x,y,'-b')
>>holdon
>>a=polyfit(x0,y0,3)
a=
0.0000-0.2395-1.00001.6092
>>y=a(4)+a(3).*x+a
(2).*x.^2+a
(1).*x.^3;
>>plot(x,y,'-k')
>>t=[2.51.50.5-0.5-1.5-2.5];
>>g=interp1(x0,y0,t,'pchip')
g=
Columns1through5
-0.9954-0.1693-0.11080.71893.0684
Column6
3.7061
>>f=interp1(x0,y0,t,'spline')
f=
Columns1through5
-1.05380.0011-0.24990.75013.0011
Column6
3.9462
>>h=interp1(x0,y0,t)
h=
Columns1through5
-1.3790-0.1700-0.07930.92072.8301
Column6
3.6210
7用经典的RK方法计算常微分方程:
y’=e-2t-2y初值条件y(0)=0.1
functionf=fun(x,y)
f=exp(-2.*x)-2.*y
>>[x,y]=ode23('fun',[0,1],1);
f=
-1
f=
-0.9969
f=
-0.9935
f=
-0.9885
f=
-0.9707
f=
-0.9616
f=
-0.9488
f=
-0.9203
f=
-0.9080
f=
-0.8911
f=
-0.8563
f=
-0.8422
f=
-0.8231
f=
-0.7853
f=
-0.7704
f=
-0.7504
f=
-0.7118
f=
-0.6970
f=
-0.6771
f=
-0.6392
f=
-0.6249
f=
-0.6056
f=
-0.5695
f=
-0.5560
f=
-0.5379
f=
-0.5041
f=
-0.4915
f=
-0.4748
f=
-0.4437
f=
-0.4322
f=
-0.4168
f=
-0.4113
f=
-0.4087
f=
-0.4059
8求二阶微分方程
初值条件为x(0)=1,x’(0)=0
建立m文件
functiondy=fun(x,y)
dy=zeros(2,1);
dy
(1)=y
(2);
dy
(2)=(1-x^2)*y
(2)-x;
ode45('fun',[0,10],[1,0]);
9用三点公式和五点公式求F(x)=1/(1+x)2在x=1.1处的导数值。
x
1.0
1.1
1.2
1.3
1.4
F(x)
0.2500
0.2268
0.2066
0.1890
0.1736
>>x=[1:
0.1:
1.4];
>>fun=1./(1+x).^2;
>>y=subs(fun,x)
y=
0.25000.22680.20660.18900.1736
>>h=0.1;
>>a=1/(2*h)*(y(3)-y
(1))
a=
-0.2169
>>b=1/(12*h)*(-3*y
(1)-10*y
(2)+18*y(3)-6*y(4)+y(5))
b=
-0.2160
10
求
>>symsx
>>f=(x^3+x^2+x+1)^(1/3)-sqrt(x^2+x+1)*log(exp(x)+x)/x
f=
(x^3+x^2+x+1)^(1/3)-(x^2+x+1)^(1/2)*log(exp(x)+x)/x
>>limit(f,x,inf)
ans=
-1/6
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 中南 大学 matlab 题目