Replace one value in a 2 variable's function

Hello. When we have a function of 2 variables is it possible to replace only one of them with a value (so after that it is a function of 1 variable). I want to do this without symbolic functions . for example input @(x,a)(..)=f then with 'for' loop the a changes every time so I want to write sth like feval(f,a-only) and f=@(x) and solve the equation with f(x) (newtons method but its not that matters)
I cant understand how I can say that i replace only a.

回答(1 个)

g=@(x)f(x,a)
Then work with g.
Best wishes
Torsten.

3 个评论

Thank you. But there is no need of feval(f,a)? or sth like that? to define that its the same but replaces the a?
No.
Best wishes
Torsten.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by