Homework Solution: Help me write a MatLab code….

    Help me write a MatLab code. Solve y+ y – 7y - 6y = 0 y(0)=1,y'(0)=0, y''(0)=-2, y'''(0)=-1? analytically (by hand). Graph the soultion in red with x- and y-axis labels.
    y+ y" – 7y" - 6y = 0

    Expert Answer

    Help me transcribe a MatLab decree.

    Solve y+ y – 7y - 6y = 0

    y(0)=1,y'(0)=0, y''(0)=-2, y'''(0)=-1? analytically (by laborer).

    Graph the soultion in ruddy with x- and y-axis labels.

    y+ y” – 7y” – 6y = 0

    Expert Response

     

    Executable Matlab Decree:

    function solvingequation()
    [t, y] = ode45(@solveeq, [0 1], [1 0 -2 -1 0]);
    % conspire the result
    plot(t, y(:,1),’r’)
    xlabel(‘t’)
    ylabel(‘y’)
    % linearized ode
    function diffy = solveeq(t,y)
    diffy = zeros(4,1);
    diffy(1) = y(2);
    diffy(2) = y(3);
    diffy(3) = y(4);
    diffy(4) = y(5);
    diffy(5) = -y(4)+7*y(3)-6*y(1);
    end
    end