You are working for an insurance testing company. Your company recently ordered
ID: 3566495 • Letter: Y
Question
You are working for an insurance testing company. Your company recently ordered a new accelerometer to be used in vehicle testing. An evaluation and verification of the new sensor (accelerometer) is required prior to publishing data from crash testing. You arc the Lead Test Engineering developing the required testing and documentation. The first phase of the task is for you to submit to the NHTSA software used for data reduction and evaluation of the accelerometers. Your responsibility is the software that will determine the velocity and position from the output of the accelerometer. You are required to create a MATLab function that will have three (3) input variables. Two input arrays with the following format: Where axi, ayi, and azi are the measured acceleration in m/s2 in the x, y. and z directions at time ti. The length, N, of accel and time are unknown but you may assume the length is between 3 and 10,000. The other input array should provide the initial velocity (at t=0) and have the format shown below: The function must produce an output array with length, N-l, that contains the velocity of the sensor in m/s. The output array should have the format below: Where vxi, vyi, and vzi are the calculated velocity in m/s in the x, y, and z directions at time ti. You can NOT use the following MATLab commands; 'diff()' or 'trapz()'. You must create your own version of any integration or differentiation needed in you function. As we did in class. Requirements: Create a MATLab function to perform the above calculations using the defined input and create the specified output. Your function should look like "(velocity]"p3me(accel,time,vinit)' Your function should work correctly for positive or negative accelerations. Your function must be named correctly. That is the file and function must have the same name. Your function should only produce the specified output variables in the "Workspace"Explanation / Answer
accel= input(' please enter the array of acceleration ');
vinit= input (' please enter the array of initial velocity ');
time= input( 'please enter the array of time ');
N= length(time);
%using euler integration
velocity (1,1)= vinit(1)+accel(1,1)*(time(2)- time(1));
velocity (1,2)= vinit(2)+accel(1,2)*(time(2)- time(1));
velocity (1,3)= vinit(1)+accel(1,3)*(time(2)- time(1));
i=2;
while i<(N)
velocity (i,1)= velocity (i-1,1)+accel(i,1)*(time(i+1)- time(i));
velocity (i,2)= velocity (i-1,2)+accel(i,2)*(time(i+1)- time(i));
velocity (i,3)= velocity (i-1,3)+accel(i,3)*(time(i+1)- time(i));
i=i+1;
end
time (1,:)=[];
figure (1)
plot(time, velocity(:,1))
title('velcity in x direction vs time');
xlabel('time');
ylabel(' velocity in x direction');
figure (2)
plot(time, velocity(:,2))
title('velcity in y vs time');
xlabel('time');
ylabel(' velocity in y direction');
figure (3)
plot(time, velocity(:,3))
title('velcity in z direction vs time');
xlabel('time');
ylabel(' velocity in z direction');
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.