MATLAB Answers

How to define a constat in function handle?

조회 수: 3(최근 30일)
jomson joy
jomson joy 2021년 9월 15일
댓글: jomson joy 2021년 9월 15일
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

채택된 답변

Matt J
Matt J 2021년 9월 15일
편집: Matt J 2021년 9월 15일
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
jomson joy
jomson joy 2021년 9월 15일
The symbolic one. That was the command I was looking for.
Thanks you.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by