How to solve error using integral (line 83) first input argument must be a function handle?
1 次查看(过去 30 天)
显示 更早的评论
It is necessary to calculate the function "z" and its values, to build a 3D graph depending on "x" and "y".
I enter commands:
xi=0.062
m=64
[x,y,ksi]=meshgrid(-1:0.1:1,2:0.2:10,-1:0.1:1)
y1=((sign((x./y)+ksi).*((1+xi)./2)+((1-xi)./2)).*((x./y)+ksi ))^m
z=(integral(y1,0,1)).^(1./m)
After the last command it gives an error:
error using integral (line 83)
first input argument must be a function handle
Tell me, what's the problem?
采纳的回答
Torsten
2023-1-26
T = 1;
m = 64;
x = 1:0.1:2;
y = 2:0.2:10;
[X,Y] = meshgrid(x,y);
g = @(u)sin(2*pi*u);
phi = @(t,x,y) ((sign(x/y+g(t/T)).*(1+t/T)/2+(1-t/T)/2).*(x/y+g(t/T))).^m;
sol = (arrayfun(@(x,y)1/T*integral(@(t)phi(t,x,y),0,1),X,Y)).^(1/m)
3 个评论
Torsten
2023-2-28
编辑:Torsten
2023-2-28
I'm a little bit confused about your t/T with respect to which you integrate.
According to your notation, my guess is that the integral should be
m = 64;
x = 1:0.1:2;
y = 2:0.2:10;
[X,Y] = meshgrid(x,y);
g = @(u)sin(2*pi*u);
phi = @(ksi,x,y) ((sign(x/y+g(ksi)).*(1+ksi)/2+(1-ksi)/2).*(x/y+g(ksi))).^m;
sol = (arrayfun(@(x,y)integral(@(ksi)phi(ksi,x,y),0,1),X,Y)).^(1/m)
which is a little different from which I posted first (at least for T not equal to 1).
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!