MATLAB 定积分计算function L=fun(x)h=439H=2384R=6400a=(h+H+2*R)/2c=(H-h)/2b=sqrt(a^2-c^2)d=sqrt((a.*sin(x)).^2+(b.*cos(x)).^2)L=2*quad('d',2,pi)最后两行是不是哪里出问题了,该怎么改才行?

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/22 12:14:39
MATLAB定积分计算functionL=fun(x)h=439H=2384R=6400a=(h+H+2*R)/2c=(H-h)/2b=sqrt(a^2-c^2)d=sqrt((a.*sin(x)).

MATLAB 定积分计算function L=fun(x)h=439H=2384R=6400a=(h+H+2*R)/2c=(H-h)/2b=sqrt(a^2-c^2)d=sqrt((a.*sin(x)).^2+(b.*cos(x)).^2)L=2*quad('d',2,pi)最后两行是不是哪里出问题了,该怎么改才行?
MATLAB 定积分计算
function L=fun(x)
h=439
H=2384
R=6400
a=(h+H+2*R)/2
c=(H-h)/2
b=sqrt(a^2-c^2)
d=sqrt((a.*sin(x)).^2+(b.*cos(x)).^2)
L=2*quad('d',2,pi)
最后两行是不是哪里出问题了,该怎么改才行?

MATLAB 定积分计算function L=fun(x)h=439H=2384R=6400a=(h+H+2*R)/2c=(H-h)/2b=sqrt(a^2-c^2)d=sqrt((a.*sin(x)).^2+(b.*cos(x)).^2)L=2*quad('d',2,pi)最后两行是不是哪里出问题了,该怎么改才行?
%先将下列程序存于Matlab的一个文件夹内(文件名:fun.m)
function y = fun(x)
h=439;
H=2384;
R=6400;
a=(h+H+2*R)/2;
c=(H-h)/2;
b=sqrt(a^2-c^2);
y=sqrt((a*sin(x)).^2+(b*cos(x)).^2);
%然后在指令窗口运行下列语句(注意这个语句的写法):
L=2*quad(@fun,2,pi)