Solve Complex Maths Like ODE with Laplace, Maclaurin's Series Expansion, Fourier Series Expansion and the Heat Equation (PDE) with Matlab. [Cardis!]
1. Solve d'' + 6 d' + 9y using Laplace clc; clear; syms t s Y y(t) Dy(t) assume([t Y] > 0) Dy = diff(y, t) D2y = diff(Dy, t) LS = sin(3*t) % Diff. Equation formulation: EQN=D2y+6 * Dy+9 * y-LS % Laplace transform of the Diff. Equation LEQN=laplace(EQN,t,s) % Substitute ICs and initiate the arbitrary unknown "Y" LT_Y=subs(LEQN,laplace(y,t,s),Y) LT_Y=subs(LT_Y, y(0), 0) % y(0) = 1 LT_Y=subs(LT_Y, subs(diff(y(t), t), t, 0), 0) % dy(0)= 0 % Solve for the arbitrary unknown: Y ys=solve(LT_Y,Y) % Inverse of the Laplace Transform: y=ilaplace(ys,s,t) Description: %First we cleared the workspace, the variables and declared variables as symbolic. %Declaring variables as symbolic is necessary in using the symbolic toolbox where %we have most of the tools used...