Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Tutorial problems using MATLAB

Vector fields
Consider the motion of a particle represented in a vector form by = sin + cos + between the
time instants = 0 to 8 . Compute the velocity and acceleration vectors. Visualize the motion of this particle
by plotting all the three vectors.

The velocity vector is given by, =


The acceleration vector is given by, =
! "
Length of the curve is given by, = ‖ ‖ = + +

Numerical methods
!
Consider the differential equation, = # − 2& subject to the initial condition & 0 = 1. Solve this problem
numerically using Improved Euler’s method. Compare your answer with the analytical solution and plot them
both.

Algorithm:
1. Run loop over a dummy variable n from 1 to a predefined value
2. For each value of n, calculate the values of #)*+ = #) + ℎ and &)*+

, &)*+ using,
&)*+ = &) + ℎ/ #) , &)

/ #) , &) + / #)*+ , &)*+



&)*+ = &) + ℎ
2
3. Compute the error between the exact and computed solutions as 1 = &)*+ − &2 34 where
+ 6 8
&2 34 = − + 7 at each value of x.
5 5
4. Plot and visualize the results.

Laplace transform
A spring-mass system, in presence of damping force, subjected to an external stimulus is governed by the
+ 9 +
differential equation, 9 + 1.2 + 2# = 5 cos 4 with initial conditions, # 0 = and #′ 0 = 0. Solve for
6
# using laplace transforms.

You might also like