How to make a function that uses a mathematical function as an input?

조회 수: 4 (최근 30일)
I want to create a function that takes two inputs
f(x) and x1
that I can put through the central finite differentiation formula;
y=(f(x1+h)-f(x1-h))/2h
where h is a constant
and the function on each side = f(x)
so for example;
f(x)=sin(x)
x1=2
y=sin(2+h)-sin(2-h)/2*h
I want to function input that i can subsititute into but I don't know how to go about it, I've looked at anonymous function, parameter and other documentation.
I just want a nudge in the right direction, not a complete answer if at all possible.

채택된 답변

madhan ravi
madhan ravi 2019년 3월 12일
  댓글 수: 6
Benjamin Memisevic
Benjamin Memisevic 2019년 3월 13일
Yup figured out but awesome, thanks a tonne.
Sorry for all the begginner questions, was just hard to wrap my head around the task due to its wording.
Thanks for all the help all.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by