calculate approximate derivative in matlab
16 ビュー (過去 30 日間)
古いコメントを表示
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1233122/image.png)
1 件のコメント
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
2022 年 12 月 16 日
Hi @Minh
Not sure if you are looking for this
syms x
y = log(x)
dydx = diff(y)
However, please check the data in the Table because
log(1)
Else, you can approximate the derivative using this principle
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1233187/image.png)
so long as
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1233192/image.png)
x = 0.98:0.02:1.02
y = [0.7739332 0.7651977 0.7563321]
dydx1 = (y(2) - y(1))/(x(2) - x(1))
dydx2 = (y(3) - y(2))/(x(3) - x(2))
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Mathematics and Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!