Undefined function or variable 'y'.
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Opera Era
le 22 Avr 2019
Réponse apportée : Opera Era
le 22 Avr 2019
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
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!