You are on page 1of 1

% Code 2.

clc; clear all; close all;

% Define the equation

eqn = 'D2y/ (4*4)+ (2*0.5/4)*Dy + y = 50/10'

% Solve the equation

Y = dsolve (eqn, 'y (0) 0, Dy (0) 0', 't')

% Plot the solution

t = linspace (0,5,200);

y_plot = eval (vectorize (y));

figure

hold on

plot (t, y_plot)

xlabel ('Time [sec]')

ylabel ('y [m]')

grid on

hold off

You might also like