First Order Linear Differential Equations - Matlab Programming
Our differential equation is:
dy/dx = 2*x
Matlab code for First Order Linear Differential Equations
Initial value of problem y(0) = 3
%first_order_linear_differential_equations.m
syms y(z);
% define the differential equation
ode = diff(y,x) == 2*x;
%define initial condition
cond = y(0) == 3;
ySol(x) = dsolve(ode,cond);
% run the programe
% type the ySol(x) in the command window and ENTER
%you get the answer