值。
√
函数部分:
fu
ctio
smyfu
ifabs
rou
d
disperror
retur
e
d
如果输入x不是正整数,不执行函数,并给出提示
s0
fori1
ss12i1
e
d
e
d
调用部分:
clcclear
ymufu
56myfu
28113
求出y〖f5〗6√f281值
5文件climatetxt中4列分别为年、月、当月水温、平均水温,请统计30
年间(19812011)平均4个月间(36月份)当月水温减去平均水温,并
作图。
clcclear
dataloaddataclimatetxt
adata3data4
i0
fforyy19812011
y
fi
ddata1yydata22data27
ii1
ttimea
ay
e
d
vtt
u19812011
plotuv
第三次上机作业:
1分别用符号表达式和多项式两种方法求:1当,x你
们学号的值;2fx0时的解。
clcclear
symsx
符号表达式法
f2x2x4
subsfx1429421
asolvef0x
m214
x1429421
ypolyvalmx
rootsm
多项式法
f2求
→
,fx
的一阶导数,计算fx在区间01之间的定积分。
clcclear
symsx
f1log12xsi
3x
alimitf1x2
求
→
的值
f2xcosx2
bdifff2x
fx
ci
tf2x01
的导数
fx
在区间01之间的定积分
3用ezplot绘制方程fx在区间101图,并求fx0的至少两个
解。
clcclear
symsx
fsi
x2x
ezplotf101
用ezplot绘制方程fxsi
x2x在区间101图
a1fzerosi
x2x959
求fx0的至少两个解
a2fzerosi
x2x656
4已知测定鲐鱼仔幼鱼17个月每个月按30天计之内的体长为下表单
位cm,用4种不同的差值方法和三次多项式拟合方程求每隔10天的体
t
0
1
2
4
7
9
12
13
15
17
L
03
15
39
66
117
156
188
196
206
211
长,并分别画出对比图。
fclcclear
t01247912131517
L03153966117156188196206211
subplot321
plottL
title原图
ppolyfittL3
ti01317
Lipolyvalpti
subplot322
plottL
holdo
plottiLi
title拟合
L1i
terp1tLti
subplot323
plottLtiL1
title
earest
L2i
terp1tLtil
subplot324
plottLtiL2
titleli
ear
L3i
terp1tLtis
fsubplot325
plottLtiL3
titlespli
e
L4i
terp1tLtic
subplot326
plottLtiL4
titlecubic
5cjk_depdat为长江口海域水深,请绘制经度120126、纬度2834海域内
的20、50、100m等深线图。
clcclear
dataloaddata_2cjk_depdat
latdata1
lo
dar