Cookbook: Difference between revisions

149 bytes added ,  22 August 2012
Line 82: Line 82:
We could solve the problem with the following code
We could solve the problem with the following code


{{Code|Solve spring equation for different values of the spring constant|<syntaxhighlight lang="octave" style="font-size:13px">
t = linspace (0, 10, 100);
t = linspace (0, 10, 100);
function sprime = spring (s, t, k)
function sprime = spring (s, t, k)
Line 95: Line 96:
plot (t, x1, t, x2)
plot (t, x1, t, x2)
legend ('x1', 'x2')
legend ('x1', 'x2')
 
</syntaxhighlight>}}


[[File:solparfun.png]]
[[File:solparfun.png]]
349

edits