How to solve error using integral (line 83) first input argument must be a function handle?
1 view (last 30 days)
Show older comments
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?
3 Comments
Accepted Answer
Torsten
on 26 Jan 2023
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 Comments
Torsten
on 28 Feb 2023
Edited: Torsten
on 28 Feb 2023
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).
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!