main.m439 chars21 lines
In this code snippet, we first define the function representing the differential equation x'' + 0.05x' + x^3 = 8*cos(t). Then we specify the time span, initial conditions, and finally solve the differential equation using ode45. The solution is then extracted and plotted against time.
gistlibby LogSnag