Undefined function or variable 'y'.
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Opera Era
am 22 Apr. 2019
Beantwortet: Opera Era
am 22 Apr. 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 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!