フィルターのクリア

backward,forward, and central Difference

10 ビュー (過去 30 日間)
Abra dog
Abra dog 2011 年 11 月 9 日
編集済み: Torsten 2024 年 3 月 14 日
Can any body help me understand how to do numerical differentiation? example:
t = 0:5:100; Z = cos(10*pi*t)+sin(35*pi*5);
how can I find the backward,forward and central difference at t = 99?

回答 (4 件)

Jan
Jan 2011 年 11 月 9 日
For :
t = 0:5:100;
Z(t) = cos(10*pi*t)+sin(35*pi*5);
you cannot find the forward and central difference for t=100, because this is the last point. Central differences needs one neighboring in each direction, therefore they can be computed for interior points only. For the first point, you can get a forwrad difference, for the last point a backward difference only:
dZ1 = (Z(2) - Z(1)) / (t(2) - t(1));
dzi = (Z(i+2) - Z(i-1)) / (t(i+1) - t(i-1)); % 1 < i < 100
dZ100 = (Z(100) - Z(99)) / (t(100) - t(99));
  4 件のコメント
Abra dog
Abra dog 2011 年 11 月 9 日
oh ok but what if instead of t = 0:5:100, t = 99?
Jan
Jan 2011 年 11 月 9 日
The point t=99 is not a member of t=0:5:100.

サインインしてコメントする。


Friedrich
Friedrich 2011 年 11 月 9 日
Hi,
lets say you like to get Z'(t_0) with the forward difference. You do the following
Z'(t_0) = ( Z(t_0 + h) - Z(t_0) ) / h
where h is a small offset. You actually calculate the slope of a straight line which goes through Z(t_0 + h) and Z(t_0) for forward differences.
  4 件のコメント
Abra dog
Abra dog 2011 年 11 月 9 日
ok so i found out that h is .125 so to find forward difference I just type
z'forward = ((x+h)-x)/h?
if i do that i get 1
Friedrich
Friedrich 2011 年 11 月 10 日
No, i would put it in the formula above (t_0 = x in that case).
So (cos(10*pi*(x+h)) + sin(35*pi*5) - .....) / h

サインインしてコメントする。


Fahad Maqsood
Fahad Maqsood 2018 年 12 月 9 日
Hi
I am new to matlab and struggling with it. any one who can help me getting started
Given: x 1 2 3 4 5 6
f(x) 2 3 1 5 4 1
Estimate f′(4) using the forward, backward, and centered difference method with h = 1.
and second order polynomial.
  3 件のコメント
Fahad Maqsood
Fahad Maqsood 2018 年 12 月 13 日
As i mentioned i never worked on matlab before, i searched hard for it but could not find any related problems. It has been posted for those could help others getting started. Well you have your own opinion keep it in your pocket.
Steven Lord
Steven Lord 2018 年 12 月 13 日
If you show us what you've tried so far and explain the specific difficulty you're experiencing, we may be able to provide some guidance.
If you're not even sure where to start because you're new to MATLAB, I recommend working through the MATLAB Onramp tutorial available from the Tutorials section of the Support page on this website (click the Support button at the top of this page.)
If you're not sure where to start because of the subject matter of the question, I recommend contacting your professor and/or your teaching assistant and asking them for help with the material.

サインインしてコメントする。


LE TRAN
LE TRAN 2024 年 3 月 14 日
hello everyone, I have a math problem with an error in the code.Please refer to the code
  1. Build a code to Estimate the first derivative of the following function at x=0.5 using h=0.5, 0.25, and 0.1 for the forward, backward, and centre difference approximation schemes.
  2. Make an analysis and draw some conclusions based on the results obtained.
  3. f(x)= -0,1*x^4-0,15*x^3-0,5*x^2-0,25*x+1,2
  7 件のコメント
LE TRAN
LE TRAN 2024 年 3 月 14 日
移動済み: Torsten 2024 年 3 月 14 日
The topic is in the first question comment.thank you so much.
Torsten
Torsten 2024 年 3 月 14 日
編集済み: Torsten 2024 年 3 月 14 日
We cannot execute and/or correct the graphics with your code. Include your code as plain ascii text.
And it would help if you also included the complete error message you get from this code.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNumeric Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by