Putting multiple equations into a function
Show older comments
Hey guys
I have four 1st order odes that I want to put into a function that will be later used with ode45. u1 = x1; u2 = dx1; u3 = x2; u4 = dx2
The equations go as following (These equations come from a two 2nd order odes):
du1 = dx1 = u2
du2 = d2x1 = -k1*(x1 - L1)/m1 + k2*(x2 - x1 - w1 - L2)/m1
du3 = dx2 = u4
du4 = d2x2 = -k2(x2 - x1 - w1 - L2)/m2
Where - L1 = L2 = 2; k1 = k2 = 5; m1 = m2 = 2; w1 = 5
The IC are - x1 = 2; x2 = L1 + w1 + L2 + 6
I have tried everything that I can think of but I have been getting the same error time after time and it is becoming very frustrating. Help would be greatly appreciated
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations 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!