Matlab Problem Given Code Clear Deletes Variables Omega0 2 C 0 Omega 22 Param Omega0 C Ome Q37141226

MATLAB problem!!

Given code
———————————————————————————–

clear all; %this deletes all variables
omega0 = 2; c = 0; omega = 2.2;
param = [omega0,c,omega];
t0 = 0; y0 = 0; v0 = 0; Y0 = [y0;v0]; tf = 80;
options = odeset(‘AbsTol’,1e-10,’relTol’,1e-10);
[t,Y] = ode45(@f,[t0,tf],Y0,options,param);
y = Y(:,1); v = Y(:,2);
figure(1)
plot(t,y,’b-‘); ylabel(‘y’); grid on;
C=1/abs(omega0^2-omega^2);
A=2*C*sin((omega0-omega)*t/2);
hold on
plot(t,A,’r-‘,t,-A,’r-‘);
%—————————————————————-
function dYdt = f(t,Y,param)
y = Y(1); v = Y(2);
omega0 = param(1); c = param(2); omega = param(3);
dYdt = [ v ; cos(omega*t)-omega0^2*y-c*v ];
end

———————————————————————————–

(a) Change the value of ω to 2.1 (a value closer to ω0) and thenω = 2.5 (a value farther away from ω0). Include the two graphs. Foreach of these two values of ω

OR
OR

Leave a Comment

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