The following equation describes the motion of a certain mas

The following equation describes the motion of a certain mass connected to a spring, with viscous friction on the surface 3y + 39y + 120y = f(t) Where f(t) is an applied force. Suppose that f(t) = 0 for t

Solution

clear,clc %Inputs syms x y1 y2 nn = 2; %Numero de ecuaciones del sistema dydx(1) = y2; %Ecuacion diferencial 1 (dy1/dx) dydx(2) = (1/3)*10 -13*y2 - 40*y1; %Ecuacion diferencial 2 (dy2/dx) x0 = 0; %Valor inicial en x y10 = input(\'Input y(0) \'); %Valor inicial en y1 y20 = input(\'Input y´(0) \'); %Valor inicial en y2 a = 0; %Limite inferior solucion b = 1.8; %Limite superior solucion n = 301; %Numero de puntos de red h = (b - a)/(n - 1); %Espaciado entre puntos de red %Aproximacion a la solucion X(1) = x0; Y(1,1) = y10; Y(2,1) = y20; for j = 1:n-1 X(j+1) = X(j) + h; Xm(j) = (X(j) + X(j+1))/2; for i = 1:nn k1(i) = subs(dydx(i),{x,y1,y2},[X(j),Y(1,j),Y(2,j)]); end for i = 1:nn Ym(i,j) = Y(i,j) + (1/2)*k1(i)*h; end for i = 1:nn k2(i) = subs(dydx(i),{x,y1,y2},[Xm(j),Ym(1,j),Ym(2,j)]); end for i = 1:nn Ym(i,j) = Y(i,j) + (1/2)*k2(i)*h; end for i = 1:nn k3(i) = subs(dydx(i),{x,y1,y2},[Xm(j),Ym(1,j),Ym(2,j)]); end for i = 1:nn Ym(i,j) = Y(i,j) + k3(i)*h; end for i = 1:nn k4(i) = subs(dydx(i),{x,y1,y2},[X(j+1),Ym(1,j),Ym(2,j)]); end for i = 1:nn Y(i,j+1) = Y(i,j) + (h/6)*(k1(i) + 2*k2(i) + 2*k3(i) +k4(i)); end end X ; %Valores de la funcion y(x) en x Y ; %Valores de la funcion y(x) en y plot(X,Y) grid on title(\'y y´ Vs t\') xlabel(\'time\') ylabel(\'y(t) y´(t)\') %%%%%%%%%%%%%%%%%%%%%%%%%%%% % System of equations % y1(t) = y(t) % y2(t) = y1´(t) = y´(t) % y2´(t)= y1´´(t) = y´´(t) % t will be always positive so f(t) = 10 %%%%%%%%%%%%%%%%%%%%%%%%%
 The following equation describes the motion of a certain mass connected to a spring, with viscous friction on the surface 3y + 39y + 120y = f(t) Where f(t) is

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site