In: Advanced Math
This is a Matlab Question
Create MATLAB PROGRAM that can solve First Order Linear Differential Equation ( 1 example contains condition and the other does not have condition).
1. ty′ + 2y = t^2 − t + 1, y(1)=12
The correct answer is y(t) = 1/4 t^2 − 1/3 t + 1/2 + 1/12t^2
2. (x-1) dy/dx + 2y = (x+1)^2
The correct answer is y = (x(x+1) / x-1 ) + C(x+1) / x-1
The correct answer is
code 1:
syms y(t)
ode = diff(y,t) == t-1 + 1/t - (2/t)*y
ode = (sym)
cond = y(1) == 12;
ySol(t) = dsolve(ode,cond)
code 2:
syms y(t)
ode = diff(y,t) == ((t+1)^2)/(t-1) - (2*y)/(t-1)
ode = (sym)
ySol(t) = dsolve(ode)