3 Use Simpsons Rule to approximate the impulse given data fr

3. Use Simpson\'s Rule to approximate the impulse, given data from a force sensor. Use the xlsread function (see pg. 114 in your textbook) to import the data from the Excel file provided. impulses|-| Fdt impulse = 1-1 F dt

Solution

filename = \'data.xlsx\'; %change according to your file name
data = xlsread(filename); %reading file
data_size = size(data, 1); %size of the data
I = 0; %intialising the value of impulse
I = I + data(2,1)*(1.0/3.0)*data(2,2)/(1.0*data_size); %value of impulse for first time instance
I = I + data(end,1)*(1.0/3.0)*data(end,2)/(1.0*data_size); %value of impulse for last time instance

%iterating through the values of time and force
for i=3:1:data_size-1
    if mod(i,2) == 0
        I = I + data(i,1)*(4.0/3.0)*data(i,2)/(1.0*data_size); %for even
    else
        I = I + data(i,1)*(2.0/3.0)*data(i,2)/(1.0*data_size); %for odd
    end
end

disp(I); %displaying the value of impulse

 3. Use Simpson\'s Rule to approximate the impulse, given data from a force sensor. Use the xlsread function (see pg. 114 in your textbook) to import the data f

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site