You can use dsolve in MATLAB...run simplify(...) on the
solution...You should plot the homogeneous and the inhomogeneous
solutions on the same graph, using the "plot" function
of MATLAB. set the arbitrary constants to 1
Consider the homogeneous equation y'' + 3y' + 2y = 0.
a) Solve it and set the c's to 1. Graph this transient
solution
using large dots in MATLAB.
b) Now add on the right-hand side the linear term 12x.
Solve the inhomogeneous equation y'' + 3y' + 2y = 12x
and find the particular solution due to the linear term.
c) To see the effect of this term, graph the full solution
on the same set of axes using a solid line of a different
color.
please post picture in PDF file. thanks
%%% Matlab code
%%% Here variable is t not x .. don't confuse
clc;
clear all;
close all;
%%%%(a)
syms y(t)
eqn = diff(y,t,2) +3*diff(y)+2*y == 0;
ySol(t) = dsolve(eqn);
disp('Homogenous solution is : ');
disp(ySol);
C1=1;
C2=1;
yh=@(t) C1*exp(-2*t) + C2*exp(-t);
%%%% (b)
syms y(t)
eqn = diff(y,t,2) +3*diff(y)+2*y == 12*t;
ySol(t) = dsolve(eqn);
disp('Complete solution is : ');
disp(ySol);
C3=1;
C4=1;
yc=6*t + C3*exp(-2*t) + C4*exp(-t) - 9
fplot(yh,[0 10]);
hold on
fplot(yc,[0 10]);
grid on
xlabel('x');
legend('Homogenous solution','Complete solution');
OUTPUT:
Homogenous solution is :
C1*exp(-2*t) + C2*exp(-t)
symbolic function inputs: t
Complete solution is :
6*t + C3*exp(-2*t) + C4*exp(-t) - 9
symbolic function inputs: t
Get Answers For Free
Most questions answered within 1 hours.