# double differentiation and double integration of sine wave

20 ビュー (過去 30 日間)
ilyas mohamed 2019 年 11 月 9 日
Answered: John D'Errico 2019 年 11 月 9 日
hi there
i was having some probelms integrating accleration signal to obtain velocity and position, first of all i started of by differentating position x(t)= 0.5 sin*(2pi/5*t) to obtain velocity and acceleration by differentating twice from position and then plot them, then once i have my acceleration derivative obtained from differentating position x(t) twice, i went onto perform double intgration on my acceleration derivative using cumtrapz function and plot my velocity and position graphs, now i was expecting to see the same plot becuase differentaitng position x(t) twice to obtain velocity and acceleration should give me the same plot as intgrating acceleration obtained from differentating position x(t) twice should give me position and velocity plot same as the the other velocity and position plot, but unfortunatlly i did not get the same graphs for my velocity and position.
i would very much appreciate if someone could show me how to differntiate position twice to obtain velocity and accleration and plot them, then getting the same results when we double integrate our accelertion obtained from position x(t) to obtain velocity and position, with time interval of 5 seconds in 100 points.

#### 0 件のコメント

サインイン to comment.

### 件の回答 (1)

John D'Errico 2019 年 11 月 9 日
This is not a question about MATLAB, just understanding some basic mathematics. At least, understanding calc 101.
First, you need ot understand that a trapezoidal rule is NOT an exact integration, any more than differentiation of a numerical series using diff is an exact differentiation. (Worse, if you are not careful about how you did the differentiation, you may have gotten that part wrong too, because diff, as applied to a sequence is NOT a derivative, but a simple difference between consecutive terms. You can make it an approximate derivative, by dividing by the stride between terms. But that is only an approximation.) Note that the gradient function will give you a better approximation for the derivative, as well as properly taking care of the stride between points in the series.
Next, when you integrate a function, you should have learned that the result actually has a constant of integration. (I did say basic calc.) But if you just forget about that constant of integration, then you are impllicitly assuming it is zero, and that is often the wrong thing to do. Did you ignore the constant of integrtion? I think you did, as it will be crucially important! In fact, there are two such constants of integration to worry about.
If you want a better answer, then you should show what you did, as this clearly looks like homework. It is far better for someone to correct what you would try than to write your homework for you.

#### 0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

Translated by