Tutorials > Solving > Task 3–3: Solving ODEs with Solve Blocks
Task 3–3: Solving ODEs with Solve Blocks
As for solving systems of equations in solve blocks, you can use natural notation for solving ODEs. Use a solve block and a new input function to solve the mass-spring-damper system.
1. Define the mass m, the damping coefficient c, and the spring constant k.
2. Define the input function u(t).
3. Enter the following solve block. On the Math tab, in the Operators and Symbols group, click Operators and then click the Prime Operator to enter the derivatives of x. Define the initial conditions of your problem, and then call the odesolve function.
When solving ODEs in solve blocks, you must define initial or boundary conditions for your problem instead of guess values.
4. Plot the solution over the range 0 < t < 10.
Parameterizing ODEs
1. Copy and paste the solve block to a new spot in your worksheet.
2. Parameterize the initial conditions. You must add one argument per parameter to the function definition. Here, define y(a, b).
3. Define two functions with different initial conditions.
4. Plot the two functions.
Was this helpful?