Changes

Jump to navigation Jump to search
177 bytes added ,  10:11, 22 August 2012
==== Solution ====
<We could solve the problem with the following code> 
t = linspace (0, 10, 100);
xprime function sprime = @spring (xs, t, k) x = s(1); v = s(2); sprime(1) = v; sprime(2) = - k * x;endfunction
k = 1;
x1 = lsode (@(x, t) xprime spring (x, t, k), [1;0], t)(:, 1);
k = 2;
x2 = lsode (@(x, t) xprime spring (x, t, k), [1;0], t)(:, linspace 2);plot (0t, 10x1, 100t, x2)legend ('x1', 'x2');plot </code>[[File:solparfun.png]]
==== Discussion ====
349

edits

Navigation menu