Undefined function or variable 'y'.
Afficher commentaires plus anciens
I try to create function, but get strange error "Undefined function or variable 'y'.", i have same code but not in function and it is works, why function gave me this error?
PS Comment\Uncomment a(1,1)
syms i j x y
n = 3;
lambda = 1;
mu = 1;
x_min = 0;
x_max = 1;
y_min = 0;
y_max = 1;
p = @(x,y) x+2.*y
N = sym('N',[1 n])
for k = 1:n
N(k) = @(x,y) sin(k.*pi.*x./n).*sin(k.*pi.*y./n);
end
i = 1
j = 1
f = @(x,y,i,j) p(x,y).* N(i).* N(j)
h = @(y) int(f(x,y,i,j), x, x_min, x_max)
vpa(int(h(y), y, y_min, y_max))
a(1,1)
function fun = a(j,i)
f = @(x,y,i,j) p(x,y).* N(i).* N(j)
h = @(y) int(f(x,y,i,j), x, x_min, x_max)
fun = vpa(int(h(y), y, y_min, y_max))
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!