필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

how to perform Numerical differentation

조회 수: 1 (최근 30일)
suvadip paul
suvadip paul 2015년 3월 24일
마감: MATLAB Answer Bot 2021년 8월 20일
Suppose I can generate infinitely many values of x and f(x). Now I need the value of f'(x) at x=1. What is the best way to find it with satisfactory accuracy.

답변 (1개)

John D'Errico
John D'Errico 2015년 3월 24일
편집: John D'Errico 2015년 3월 24일
I would use a tool that is designed to solve that problem - derivest . Of course, since I wrote the tool, that makes it obvious. It is on the File Exchange. Download the code to use it.
A nice feature of derivest is it also gives you an estimate of its uncertainty in that estimate.
So, for example...
[dydx,err] = derivest(@sin,2)
dydx =
-0.416146836547146
err =
1.5487174604626e-14
Was it correct? Looks ok to me.
cos(2)
ans =
-0.416146836547142
abs(dydx - cos(2))
ans =
3.5527136788005e-15
  댓글 수: 3
Torsten
Torsten 2015년 3월 24일
With or without strong noise ?
Maybe you could include a graph ?
Best wishes
Torsten.
John D'Errico
John D'Errico 2015년 3월 24일
Nothing in that tool presumes the "functional form" is known. It merely assumes that you give it a general function, and that it can evaluate the function, then computing the derivative at your location.
It requires nothing more than that your function be smooth and moderately well-behaved. Of course, if your function contains noise, then you must use a tool that is capable of dealing with noise. In that case, I would suggest fitting a simple low order polynomial model in the vicinity of the point in question. Polyfit would then suffice.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by