matlab中的微分

发布于 2024-12-18 08:47:21 字数 279 浏览 5 评论 0原文

我需要找到物体的加速度,文本中给出的公式是 a = d^2(L)/d(T)^2 ,其中 L= 长度,T= 时间 我通过使用这个方程在matlab中计算了这个

a = (1/(T3-T1))*(((L3-L2)/(T3-T2))-((L2-L1)/(T2-T1))) 

,或者

a = (v2-v1)/(T2-T1) 

但我没有得到正确的答案,任何人都可以告诉我如何通过matlab中的任何其他方法找到(a)。

i need to find acceleration of an object the formula for that given in text is a = d^2(L)/d(T)^2 , where L= length and T= time
i calculated this in matlab by using this equation

a = (1/(T3-T1))*(((L3-L2)/(T3-T2))-((L2-L1)/(T2-T1))) 

or

a = (v2-v1)/(T2-T1) 

but im not getting the right answers ,can any body tell me how to find (a) by any other method in matlab.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听你说爱我 2024-12-25 08:47:21

这与matlab无关,你只是试图对一个函数进行两次数值微分。根据函数的高阶(三阶、四阶)导数的行为,这将或不会产生合理的结果。假设 L 是四次可微分,您还必须预期使用类似于您正在使用的公式会出现 |T3 - T1|^2 阶错误。您可以尝试使用对称近似,而不是使用不同大小的间隔,就像

v (x) = (L(x-h) - L(x+h))/ 2h
a (x) = (L(x-h) - 2 L(x) + L(x+h))/ h^2 

我在数值数学讲座中回忆的那样,这更适合高阶导数的数值计算。您仍然会遇到顺序错误,

C |h|^2, with C = O( ||d^4 L / dt^4 || )

||.|| 表示函数的最高范数(即 L 的四阶导数需要有界)。如果这是真的,您可以使用该公式来计算必须选择多小的 h 才能产生您愿意接受的结果。但请注意,这只是理论错误,是对 L 的泰勒近似进行分析的结果,请参阅 [1] 或 [2] - 这是我刚才得到的地方 - 或任何其他数值数学入门书。根据 L 评估的质量,您可能会得到额外的错误;另外,如果|L(xh) - L(x)|非常小,则数值减法可能会出现病态。

[1] 安格曼·纳布纳; NumerikpartiellerDifferentialgleichungen;施普林格

[2] http://math.fullerton.edu/mathews/n2003/numericaldiffmod.html

This has nothing to do with matlab, you are just trying to numerically differentiate a function twice. Depending on the behaviour of the higher (3rd, 4th) derivatives of the function this will or will not yield reasonable results. You will also have to expect an error of order |T3 - T1|^2 with a formula like the one you are using, assuming L is four times differentiable. Instead of using intervals of different size you may try to use symmetric approximations like

v (x) = (L(x-h) - L(x+h))/ 2h
a (x) = (L(x-h) - 2 L(x) + L(x+h))/ h^2 

From what I recall from my numerical math lectures this is better suited for numerical calculation of higher order derivatives. You will still get an error of order

C |h|^2, with C = O( ||d^4 L / dt^4 || )

with ||.|| denoting the supremum norm of a function (that is, the fourth derivative of L needs to be bounded). In case that's true you can use that formula to calculate how small h has to be chosen in order to produce a result you are willing to accept. Note, though, that this is just the theoretical error which is a consequence of an analysis of the Taylor approximation of L, see [1] or [2] -- this is where I got it from a moment ago -- or any other introductory book on numerical mathematics. You may get additional errors depending on the quality of the evaluation of L; also, if |L(x-h) - L(x)| is very small numerical substraction may be ill conditioned.

[1] Knabner, Angermann; Numerik partieller Differentialgleichungen; Springer

[2] http://math.fullerton.edu/mathews/n2003/numericaldiffmod.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文