MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   数学建模专区 (https://www.labfans.com/bbs/forumdisplay.php?f=62)
-   -   求助:关于maltab的M函数 (https://www.labfans.com/bbs/showthread.php?t=9116)

beijiangxue 2009-06-30 21:44

求助:关于maltab的M函数
 
function y=Bi(x)
%函数名:Bi
%函数功能:计算函数Bi
%参数:x,t
y=(1/pi)*int((exp((-(t^3)/3)+x*t)+sin((t^3)/3+x*t)),t,0,inf)
end
y=Bi(0.1)

为什么有错误:
??? function y=Bi(x)
|
Error: Function definitions are not permitted at the prompt or in scripts.

yuwk77 2009-06-30 22:03

回复: 求助,非常感谢!
 
把函数改成这样就行了,因为积分、求导都是符号运算,必须把t定义成符号变量
function y=Bi(x)
%函数名:Bi
%函数功能:计算函数Bi
%参数:x,t
syms t
y=(1/pi)*int((exp((-(t^3)/3)+x*t)+sin((t^3)/3+x*t)),t,0,inf)


所有时间均为北京时间。现在的时间是 01:00

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.