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'' + y = 0.
a) Solve it and set the c's to 1. Graph this periodic
solution
using large dots in MATLAB.
b) Now add on the right-hand side the term -cos(2x).
Solve the forced harmonic oscillator y'' + y = -cos(2x)
and find the particular solution due to the new 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.
Note that the term -cos(2x) does not cause resonance here,
because its frequency is 2
please post picture of graph in PDF file.thanks
c)
%% Matlab code
format long
x=linspace(0,10,100);
yh=cos(x)+sin(x);
yp=1/3*cos(2*x);
figure;
plot(x,yh);
hold on
plot(x,yp);
hold on
plot(x,yp+yh)
xlabel('x');
grid on
legend('Homogenous solution','perticular solution','Complete
solution');
OUTPUT:
Get Answers For Free
Most questions answered within 1 hours.