필터 지우기
필터 지우기

first forward and backward central diference

조회 수: 2 (최근 30일)
Adam
Adam 2012년 4월 23일
Hi, I have a task to do by diference of those formulas someone help me? input values are specified they get when I have done.
dy1=((f(x+h)-f(x-h))/(h))-1/2*h;
dy2=(((-3*f(x))+4*f(x+h)-f(x+2*h))/(2*h))+1/3*h^2;
dy3=((f(x+h)-f(x-f))/2*h)-1/6*h^2;
  댓글 수: 3
Titus Edelhofer
Titus Edelhofer 2012년 4월 23일
I understand the task. But I have not found a question?
Adam
Adam 2012년 4월 23일
I do not know what I should do next, the result is some kind of strange
t=0.8;
h = 0:t:10^-5;
x=5;
f(x)=(x^2)+3;
dy=((f(x+h)-f(x-h))/(h))-1/2*h

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

답변 (2개)

Titus Edelhofer
Titus Edelhofer 2012년 4월 23일
Hi,
o.k., let's start with the h:
0:t:10^-5
will be the zero. Start with e.g.
h = 0.01;
Take a look at the chapter about defining functions (or search the doc for "function handles" on how to define f.
Titus

Walter Roberson
Walter Roberson 2012년 4월 23일
Algebra. What is f(x)=(x^2)+3 evaluated at (x+h) ? And at (x-h) ? And so on. Simplify and you get down to a nice formula.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by