How do I make a univariate function handle out of a multivariate function?

I want to use the eigs function with function handle input:
d = eigs(Afun,n,___)
Here Afun is a function handle, which -for generic vector x- returns A*x, i.e. Afun(x) = A*x.
I have a function, let's say Aasfunction(x,lambda), which indeed returns A*x, and A depends on a parameter lambda: A=A(lambda).
How can I create a univariate function handle from Aasfunction(x,lambda), with one input, and fix lambda in the definition?
(I guess I can alway define a function Awithfixedlambda(x)=Aasfunction(x,lambda), and lambda is fixed to some numerical value inside the function definition, but I'm looking for a solution, where I can avoid this.)
Thank you!

 채택된 답변

Gyorgy Feher
Gyorgy Feher 2020년 7월 27일
편집: Gyorgy Feher 2020년 8월 4일
Ok, it seems the following works:
lambda=...; %define lambda at whaatever value you want
Afun=@(x) Aasfunction(x,lambda);
eigs(Afun,...) %there is a necessary second parameter, the dimension of A, which needs to be specified
Also, check out this thread:

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

제품

릴리스

R2019b

질문:

2020년 7월 27일

편집:

2020년 8월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by