how to active variables in handle function

Hi, I am using the NAG toolbox for Matlab to do an integration using the d01aj function. The d01aj needs an auxiliar function (in my case, 'auxi'). I need it with some variables that were generated before in the code, how can I have these varibles (x,y,x) available in the auxi function?
[result] = d01aj('auxi',l,u,epsabs,epsrel);%
[result] = auxi(x,y,z)
Is there a way to plug them in a handle function?

 採用された回答

Walter Roberson
Walter Roberson 2011 年 11 月 4 日

0 投票

[result] = d01aj(@(P)auxi(P,x,y,z),l,u,epsabs,epsrel);

その他の回答 (1 件)

Gledson
Gledson 2011 年 11 月 4 日

0 投票

Hi Walter,
Thank you.
I did it, but it says:
Error using d01aj Parameter number 1 is not a string (containing the name of a MATLAB command).
So, the d01ak do not recognise when I do not put auxi between inverted commas.

2 件のコメント

Walter Roberson
Walter Roberson 2011 年 11 月 4 日
Atch.
In that case, I think you are going to have to use global variables or their kin.
Gledson
Gledson 2011 年 11 月 10 日
thanks, Walter.

サインインしてコメントする。

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by