How to define a constat in function handle?

1 view (last 30 days)
Hello,
Suppose I have to define a polynomial with function hadle of f(x,y) = ax^2+by+c with a, b, c as constants. So I can do the other mathematical operations likr integration, differentiation with this function handle.
Please note that I dont want to define the constants as numbers like f = @(x,y) 3x^2+4y+5.
Could someone please help me?
Thanks and regards

Accepted Answer

Matt J
Matt J on 15 Sep 2021
Edited: Matt J on 15 Sep 2021
You mean like this?
[a,b,c]=deal(3,4,5);
f = @(x,y)a*x.^2+b*y+c
f = function_handle with value:
@(x,y)a*x.^2+b*y+c
Or like this?
syms x y a b c f(x,y)
f(x,y)=a*x.^2+b*y+c
f(x, y) = 
  1 Comment
jomson joy
jomson joy on 15 Sep 2021
The symbolic one. That was the command I was looking for.
Thanks you.

Sign in to comment.

More Answers (0)

Categories

Find more on Polynomials in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!