Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The equations of motion for a certain mechanical system with two degrees of free

ID: 3840844 • Letter: T

Question

The equations of motion for a certain mechanical system with two degrees of freedom, can be written as a pair of coupled, second-order, differential equations: (M + m)x - 1/2 mL theta^2 sin(theta) + 1/2 mL theta cos(theta) + k(x - L_0) = 0 1/3 mL^2 theta + 1/2 mLx cos(theta) + 1/2 mgLsin(theta) = 0 We can rewrite them in matrix form, A*qdd - b, to be solved simultaneously: [M + m 1/2 mL cos theta 1/2 mL cos theta 1/3 mL^2][x theta] = [1/2 mL theta^2 sin theta - k(x - L_0) -1/2 mg mgL sin theta] Write a MATLAB program that: prompts the user to enter M, m, L, k, L_0, and g, initial x, theta, x, and theta, and duration, provides default values of 1 kg, 1 kg, 1 m, 10 N/m, 1 m, 9.81 m/s^2, 0 m, 0 rad, 0 m/s, 0 rad/s, and 5 seconds so that the user can run the program without typing any values. For example: m - str2num(input('Enter mass m in kg (1): ', 's')); if isempty(m), m = 1; end % if nothing entered, supply default uses ode45() to solve these equations simultaneously, and qdd = AB; % calculate accelerations iron inv(A)*B, but faster graphs both x and theta as functions of time on a single plot with appropriate axes labels that include units, a legend, and a title the with all constants, parameters, and initial condition with units and formatted appropriately. Submit the following: your MATLAB program formatted in 10 pt courier font 1 plot showing the motion with the default values 1 plot showing noticeably different motion with a different set of values

Explanation / Answer

function myoutput=myode45function(t)
disp('Enter M,m,L,k,Le and g');
M=input('Enter value of M:');if isempty(m), m=1;
m=input('Enter value of m:');if isempty(m), m=1;
L=input('Enter value of L:');if isempty(L), L=1;
k=input('Enter value of k:');if isempty(k), k=10;
Le=input('Enter value of L0');if isempty(Le), Le=1;

g=input('Enter value of g');if isempty(g), g=9.81;

disp('Enter initial condition values');
x=input('Enter value of x'); if isempty(x), x=0;
xdash=input('Enter value of xdash'); if isempty(xdash), xdash=0;
theta=input('Enter value of theta'); if isempty(theta), theta=0;
thetadash=input('Enter value of thetadash'); if isempty(thetadash), thetadash=0;

myoutput=[(1)*m*L*thetadash - k(x-Le);(-1)*m*g*L*sin(theta)][M+m,(1/2)*m*L*cos(theta);(1/2)*m*L*cos(theta) (1/3)*m*L*L];
end

clear all;

dur=input('Enter time duration');if isempty(dur), dur=5;
time_period=[0 dur];
[t,y]=ode45(@myode45function,time_period);
plot(t,y(:,1)),title('y')

figure

plot(t,y(:,2)),title('ydot')

HOPE It HELPS

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote