Topic: program MATLABCASE 1Problem Statement:Damped free vibrations can be modelled by considering a block of mass m that isattached to a spring and a dashpot as shown.From Newton?s second law of motion, the displacement x of the mass as a function oftime can be determined by solving the differential equation:where k is the spring constant, and c is the damping coefficient of the dashpot. If the massis displaced from its equilibrium position and then released, it will start oscillating backand forth. The nature of the oscillations depends on the size of the mass and the values ofk and c.a) MATLAB Script file:clear all;clf;%This is a Script file that calls for m,k,c and xm=input(?Please enter the mass of the Block(m)n?); %expects the mass of the Block from the userk=input(?Please enter the spring constant(k)n?); %expects the spring constant from the userc=input(?Please enter the damping coefficient(c)n?); %expects the damping coefficient from the userT0=input(?Please enter the starting tn?); %expects the starting time from the userTn=input(?Please enter the ending tn?); %expects the ending time from the userx(1,1)=input(?Please enter the x1 value at the starting tn?); %expects the initial value of xx(2,1)=input(?Please enter the x2 value at the starting tn?); %expects the velocity @ t=0fname=input(?Please enter the function file please:?,?s?);[tout,xout]=ode45(fname,[T0 Tn],[x(1,1) x(2,1)]);fprintf(?The Displacement is %f at time %fn?,xout,Tn);fprintf(?The Velocity is %f at time %fn?,tout,Tn);b) M-File to calculate x and vSince the equation in the question is a Second Degree Linear Differential equation we will use the ODE45 MATLAB code. Thefunction can be called by using the following equation:[tout,xout]=ode45(fname,[T0 Tn],[x(1,1) x(2,1)]);tout = Velocity of the Block at a certain timexout = Displacement of the Block at a certain timeThe Vanderpol mentioned in Chapter 13 is used to solve the Second Degree Linear Differential equation into 2 First DegreeDifferential equations.% this funtion uses the vanderpol functionfunction yp = vanderpol(t,x)yp=[x(2);(-0.1)*(3*x(2)+(28*x(1)))];c) M-File to create the animation of the mass of motionThe ?movie? function is used to create an animation for the Block.L=4; %length of the BlockW=2; %width of the Blockn=length(xout) %no. time we get xoutfor i=1:naxis equal;axis([-3 18 -3 18]);hold on;X(1) = xout(i);Y(1) = xout(i);X(2) = X(1) + L;Y(2) = xout(i);X(3) = X(2)+W;Y(3) = Y(2)+W;X(4) = X(1)+W;Y(4) = Y(1)+W;X(5) = X(1);Y(5) = Y(1);plot(X,Y);M(i)=getframe;clf;endh = picture;movie(h,M,3,n/2,[100 50 0 0]);d) Demonstration of the 2 casesI. C = 3N-s/m for 0<=t<=20sII. C=50N-s/m for 0<=t<=10se) Description of the ProgramA script file was generated which would be used to calculate the velocity and displacement of the Block. However the questionis a second order differential equation which can be simplified to two first degree differential equations. The ?movie?command was used to generate the animation of the oscillation of the block. In Part D, there are 2 scenarios. In the firstcase damping coefficient is 3N-s/m and in case 2 the damping coefficient is 50N-s/m. Since the damping coefficient in case tois greater than case 1 hence the block will oscillate slower as compared to case 1.CASE 2Since I was a FEM student last semester I would like to consider the FEM analysis of 2 beam elements.L1=12in L2=18inE=30x106psi Area=0.5in x 0.5in?=45? downward vertical fore @ node 2=1000lbThis problem can be solved with the MATLAB. The geometric parameters, material properties, and applied forces are input.The first step in the solution procedure is to discretize the domain, i.e. select the number of elements. The elementstiffness matrix for each of the beam elements is of the form.The second step is to transform each element stiffness matrix in local coordinates to the global coordinate system. Thistransformation is accomplished by:The transformation angle for element 1 is q = 0, and, thus, the transformation matrix is simply the identity matrix. Becausethe rotation angle is measured counter-clockwise, the transformation angle for element 2 is q = -45?.The third step is to assemble the global stiffness matrix that describes the entire structure by properly combining theindividual element stiffness matrices.The fourth step is to apply the constraints and reduce the global stiffness matrix so that the specific problem of interestcan be solved. For this problem, the displacements at node 1 and node 3 are known, i.e. U1 = U2 = U3 = U7 = U8 = U9 = 0, andthe loads are applied to node 2 are specified, i.e. F4 = 0, F5 = -1000 lb, and F6 = 0. Thus, the system of equations can bewritten as:This problem has three unknowns, U4, U5, and U6, and, thus, requires three independent equations. Matrix algebra allows threeindependent equations to be constructed by the removal of the rows and columns that correspond to the known displacements,i.e. the global stiffness matrix reduces to:The reduced Global stiffness matrix is as follows:MATLAB program to solve this:function beam2%% Step 0: Input constants%m = 2; % number of elementsb = [0.5 0.5]; % width (in)h = [0.5 0.5]; % height (in)a = b.*h; % cross-sectional areaI = b.*h.^3./12; % moment of inertial = [12 18]; % length of each element (in)e = [30*10^6 30*10^6]; % modulus of elasticity (psi)theta = [0 -45*pi/180]; % orientation anglef = -1000; % force (lbs)%% Step 1: Construct element stiffness matrix%k = zeros(6,6,m);for n = 1:mk11 = a(n)*e(n)/l(n); k22 = 12*e(n)*I(n)/l(n)^3;k23 = 6*e(n)*I(n)/l(n)^2; k33= 4*e(n)*I(n)/l(n);k36 = 2*e(n)*I(n)/l(n);k(:,:,n) = [k11 0 0 -k11 0 0;0 k22 k23 0 -k22 k23;0 k23 k33 0 -k23 k36;-k11 0 0 k11 0 0;0 -k22 -k23 0 k22 -k23;0 k23 k36 0 -k23 k33];end%% Step 2: Transform element stiffness matrices to global coordinates%shift = 0;kbar = zeros(6,6,m); Ke = zeros(9,9,m);for n = 1:mc = cos(theta(n)); s = sin(theta(n));lamda = [c s 0 0 0 0; -s c 0 0 0 0; 0 0 1 0 0 0;0 0 0 c s 0; 0 0 0 -s c 0; 0 0 0 0 0 1];kbar (:,:,n) = lamda?*k(:,:,n)*lamda;%% Step 3: Combine element stiffness matrices to formglobal stiffness matrix%for i = 1:6for j = 1:6Ke(i+shift,j+shift,n) = kbar(i,j,n);endendshift = shift + 3;endK = sum(Ke,3); Kr = K;%% Step 4: Reduce global stiffness matrix with constraints%Kr(:,9) = ; Kr(9,:) = ; Kr(:,8) = ; Kr(8,:) = ;Kr(:,7) = ; Kr(7,:) = ;Kr(:,3) = ; Kr(3,:) = ; Kr(:,2) = ; Kr(2,:) = ;Kr(:,1) = ; Kr(1,:) = %% Step 5: Solve for unknown displacements%Fr = [0; f; 0];Ur = KrFr%% Step 6: Solve for forces%U = [0;0;0; Ur; 0;0;0];F = K*UThe result obtained from MATLAB is U4 = -0.0016 in, U5 = -0.0064 in, and U6 = -0.0003 radians.GET THIS ASSIGNMENT DONE FOR FREE NOW, JUST PLACE YOUR ORDER AND DO NOT MAKE ANY PAYMENT: WE WILL COMPLETE THE PAPER FIRST BEFORE YOU PAY AND YOU PAY ONLY AFTER YOU RECEIVE AND APPROVE YOUR COMPLETED PAPER! IF YOU ARE NOT IMPRESSED, WE WILL NOT ASK ANYTHING FROM YOU! WHAT ELSE WE WILL DELIVER IT WITHIN YOUR SPECIFIED TIME FROM 3 HOURS TO 10 DAYS DEADLINE.THIS IS ONLY A LIMITED OFFER! TAKE ADVANTAGE!!
Unlike most other websites we deliver what we promise;
- Our Support Staff are online 24/7
- Our Writers are available 24/7
- Most Urgent order is delivered with 6 Hrs
- 100% Original Assignment Plagiarism report can be sent to you upon request.
GET 15 % DISCOUNT TODAY use the discount code PAPER15 at the order form.