MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] matlab 子函数与局部函数的调用 (https://www.labfans.com/bbs/showthread.php?t=17413)

mynamebz2 2012-07-25 09:48

matlab 子函数与局部函数的调用
 
就是一个主函数加上一个分段函数(子函数)
function y=A1(x)
y=10-(0.4+sinc(4*x)+1.1*sinc(4*x+2)+0.8*sin(6*x-2)+0.7*sinc(6*x-4));
plot(x,y)

function y=sinc(x)
if( x~=0)
y=sin(pi*x)/(pi*x);
else
y=1;
end
一直是调用sinc失败的啊啊啊啊
求高手指点该怎么改咩?谢谢谢谢~~~

未注册 2012-07-25 15:08

回复: matlab 子函数与局部函数的调用
 
function y=A1(x)
y=10-(0.4+sinc(4.*x)+1.1*sinc(4.*x+2)+0.8*sin(6.*x-2)+0.7*sinc(6.*x-4));
plot(x,y)

function y=sinc(x)
if( x~=0)
y=sin(pi.*x)/(pi.*x);
else
y=1;
end
点乘


所有时间均为北京时间。现在的时间是 11:13

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