From: Cecily on 9 Oct 2009 16:06 Hi, I have a question about using quadgk. According to help, I must use function handle when using quadgk. I can have fun which stores 'function name' as a string. I want to use quadgk on the function where fun stands for. I firstly use str2func to change fun to function handle. Then I use quadgk. But error still occurs Error: File: trueavg.m Line: 41 Column: 16 "funhandle" was previously used as a variable, conflicting with its use here as the name of a function or command. See MATLAB Programming, "How MATLAB Recognizes Function Calls That Use Command Syntax" for details. can someone help me? Thanks a lot!
From: Michael Hosea on 11 Oct 2009 00:38 I see the error message, but I don't know what you've done in trueavg.m, and I don't really understand what you're trying to do. Have you tried to run that file *outside* of quadgk, just passing in a value? This works: >> quadgk(str2func('sin'),0,pi) ans = 2 -- Mike "Cecily" <cecilyzhang1004(a)gmail.com> wrote in message news:12947589-2d17-4708-b4e2-663534cd06dc(a)h13g2000yqk.googlegroups.com... > Hi, I have a question about using quadgk. > > According to help, I must use function handle when using quadgk. > > I can have fun which stores 'function name' as a string. I want to use > quadgk on the function where fun stands for. I firstly use str2func to > change fun to function handle. Then I use quadgk. But error still > occurs > > Error: File: trueavg.m Line: 41 Column: 16 > "funhandle" was previously used as a variable, > conflicting with its use here as the name of a function or command. > See MATLAB Programming, "How MATLAB Recognizes Function Calls That > Use Command > Syntax" for details. > > can someone help me? Thanks a lot!
|
Pages: 1 Prev: Matlab Runtime 64-bit Next: curvefit for z=f(x,y) using fittype |