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=11596)

bobbin2002 2010-05-23 02:13

请教matlab中自定义函数问题!
 
请大虾帮帮忙!程序如下:
clear;clc
warning off
for n=1:20
f{n}=@(t)1/gamma(.2)*2^(-.8*n)*quadl(@(x)x.^(-.8).*sin(2^n*(t-x)),0,t);
end
for n=1:20
n
a{n}=[];
for t=0:.02:1
a{n}=[a{n},f{n}(t)];
end
end
a=sum(cell2mat(a.'));
plot(0:.02:1,a)
现在我想将sin(2^n*(t-x))这个含参函数变成f(2^n*(t-x)),又有f(t)=(t-2)*(t-4)+t*(t-4)+t*(t-2);不知道如何改写程序,自己做了个函数定义但运行不了,还望大虾不吝宝贵时间帮帮忙,本人拜上!
问题补充:我自己做了一个M文件myfun.m自定义
function y=myfun(t);
y=(t-2)*(t-4)+t*(t-4)+t*(t-2);
然后代入
clear;clc
warning off
for n=1:20
f{n}=@(t)1/gamma(.2)*2^(-.8*n)*quadl(@(x)x.^(-.8).*myfun(2^n*(t-x)),0,t);
end
~~~报了很多错 不知道哪儿出问题了 还请帮帮忙 谢了


所有时间均为北京时间。现在的时间是 05:58

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