calculate approximate derivative in matlab

조회 수: 13 (최근 30일)
Minh
Minh 2022년 12월 16일
답변: Sam Chak 2022년 12월 16일
Hi, I'm not sure where to begin translating the solution of this problem into a function in MATLAB.
approximate the derivative of the function y=log x at the point x=1 from the following table of numbers:
  댓글 수: 1
Jan
Jan 2022년 12월 16일
You can use the left, right or two-side quotient of differences: dx = (y - y0)/(x - x0).
The implementation is easy, but I don't want to solve your homework.

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

답변 (1개)

Sam Chak
Sam Chak 2022년 12월 16일
Not sure if you are looking for this
syms x
y = log(x)
y = 
dydx = diff(y)
dydx = 
However, please check the data in the Table because
log(1)
ans = 0
Else, you can approximate the derivative using this principle
so long as .
x = 0.98:0.02:1.02
x = 1×3
0.9800 1.0000 1.0200
y = [0.7739332 0.7651977 0.7563321]
y = 1×3
0.7739 0.7652 0.7563
dydx1 = (y(2) - y(1))/(x(2) - x(1))
dydx1 = -0.4368
dydx2 = (y(3) - y(2))/(x(3) - x(2))
dydx2 = -0.4433

카테고리

Help CenterFile Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by