Mass spring system equation help
Show older comments
I am good at Matlab programming but over here I am stuck in the maths of the problem, I am dealing with the differential equation of spring mass system mx’’+cx’+kx=0 where x’’=dx2/dt2 and x’=dx/dt. I have the values of mass and I also have the array of time and x i.e x is given for a particular value of time so I can find x’’ and x ‘ easily. I am stuck at what method to apply to find the value of c and k. I can program any method but have searched several books but didn’t get how to find c and k. If I get to know the method I can program it easily.
Accepted Answer
More Answers (3)
Sumit Tandon
on 8 Aug 2012
0 votes
I feel that if you can calculate the values of x' and x'', then you could take a couple of sets of x, x' and x'' and get a system of linear equation of the form Ax - B = 0.
Any other ideas?
In response to Sumit above:
x = 2xn matrix of x' and x, A = 1x2 matrix of c and k, and B = 1xn matrix of mx''. Solve for A.
Example:
x=[v1 v2 v3 v4;x1 x2 x3 x4];
B=[mx1'' mx2'' mx3'' mx4''];
A=x\B;
This should get you the values of c and k (c=A(1), k=A(2)).
6 Comments
Jerry
on 8 Aug 2012
Jacob
on 8 Aug 2012
That would return a single value for c and k. A is 1x2 ([c k]), and MATLAB would find the "best fit" of c and k using that method.
Jerry
on 8 Aug 2012
Greg Heath
on 8 Aug 2012
1. Divide the ODE by m and treat the normalized parameters c1 = c/m and k1 = k/m as unknowns
2. Convert the ODE and Initial Conditions to a set of Linear Finite Difference Equations
3. As suggested by previous repliers, rearrange the equations into linear matrix equation form with C = [ c1 ; k1 ] as the unknown.
4. Solve using backslash.
Jerry
on 8 Aug 2012
Jerry
on 8 Aug 2012
Greg Heath
on 9 Aug 2012
There appears to be 2 straightforward approaches:
1. For c1=c/2m, k1=k/m and sufficiently small dt(i) = t(i)-t(i-1)
a. Obtain an inhomogeneous system of linear equations for C = [c1 ; k1] by converting the differential equation to a difference equation in x(i).
b. Obtain the solution to A*C=B via C = A\B.
2. Use NLINFIT or LSQCURVEFIT to estimate c1, k1, A and B from the form of the exact solution
x(i) = exp(-c1*t(i)) * ( A * cos( sqrt(c1^2-k1) * t(i))
+ B * sin( sqrt(c1^2-k1) * (t(i) )
However, since the equation is linear in A and B, a two step estimation of [c1 ; k1 ] and [ A B] might be useful.
Hope this helps.
Greg
Categories
Find more on Assembly in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!