Undefined function or variable 'y'.
조회 수: 20 (최근 30일)
이전 댓글 표시
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
채택된 답변
추가 답변 (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!