Why am I getting undefined variable error?
显示 更早的评论
Whenever I try to run my function, I keep getting "Undefined function or variable 'k'." error.
Undefined function or variable 'k'.
Error in @(x)-(k.^2)*cos(2.*pi.*k.*x./L)
However, k is one of the inputs to my function
[eN,uN] = femet(A1,k,L,u0,uL,N,dom,f,plott)
In the above line, "f" is a funcion handle, that uses k to define it, and when f comes into play in the code is when I get the error. Interestingly enough, whenever I run the code as a string (ie just assign all the "inputs" and run the code without the whole [out]=function[in] stuff) it runs fine. however, I need it to be a callable function :/
Thanks, Kevin
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Common Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!