Using Matlab Please Help Priovide Code Answer Problem Clear Clear Variables M 1 Mass Kg K Q37177266

using matlab please help priovide code to answer problem

clear all; % clear all variables

m=1; %mass[kg]
k = 4; % spring constant [N/m]

omega0 = sqrt(k/m);

y0 =-0.8; v0 = -0.3; % initial conditions
[t,Y] = ode45(@f,[0,10],[y0,v0],[],omega0); % solve for0<t<10

y = Y(:,1); v = Y(:,2); % retrieve y, v from Y
figure(1); plot(t,y,’bo-‘,t,v,’r+-‘);% time series for y and vgridon; axistight;%—————————————————
function dYdt = f(t,Y,omega0); % function defining the DE
y = Y(1); v = Y(2);
dYdt=[ v ; – omega0^2*y ];
end

clear all: n-1; % nass [kg] k.4; % spring constant [N/ ] omega。. sqrt (k/s); yo .-0.8; vo . -o.3; % initial conditions [t,T]

15 05 1.5 10 Figure 1: Harmonic motion (e) What is the maximum velocity (in magnitude) attained by the mass, and when is sure

clear

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.