Ticker

6/recent/ticker-posts

How to solve 2nd Order Differential Equation in MATLAB?

Question:

How to solve 2nd Order Differential Equation in MATLAB

Answer:

Differential equations can be solved symbolically in MATLAB by using built-in command "dsolve"

clear all; clc; close all
syms y(x)
dy = diff(y,x);
d2y = diff(y,x,2);
eqn = d2y - 6*dy + 7*y == 6*x^2 -20*x + 3;
dsolve(eqn,x)

OUTPUT

ans =
 
C1*exp(-x*(2^(1/2) - 3)) - (68*x)/49 + C2*exp(x*(2^(1/2) + 3)) + (6*x^2)/7 - 345/343

Post a Comment

0 Comments