Lab Report Data Analysis

download Lab Report Data Analysis

of 13

Transcript of Lab Report Data Analysis

  • 8/2/2019 Lab Report Data Analysis

    1/13

  • 8/2/2019 Lab Report Data Analysis

    2/13

    ContentsDescription of Purpose And Background.......................................................................................... 3

    Theoretical Basis of Data Analysis .................................................................................................... 4

    Results ................................................................................................................................................... 6

    Conclusion ............................................................................................................................................. 8

    Discussion ............................................................................................................................................. 9

    Appendix .............................................................................................................................................. 10

  • 8/2/2019 Lab Report Data Analysis

    3/13

    Description of Purpose And Background

    The aim of this experiment is to analyse the data produced during reception of laser

    light from an emitter to a receiver via a reflector. The time difference between pulse

    emission and reception is recorded in the computer system. This time difference is

    directly proportional to the distance between the receiver and object(time of flight).

    A full scan covers 1800. A reading is taken every 0.50 giving a total number of 361 counts

    per frame. Each of the 361 counts consist of 13 effective bits of integer. If there is no

    reflection, then the value provided by the laser is R = 213 -1. This represents an infinitedistance and is the maximum vale the laser can return. The normal values lie between 0

    and 213-2 giving a maximum range of 8190 Centimetres. The data is then converted into a

    Cartesian coordinate system. The conversion equation are

    Figure 1 Laser Scanner Operation

    Figure 2 Laser Scanner- Coordinate System

  • 8/2/2019 Lab Report Data Analysis

    4/13

    Theoretical Basis of Data Analysis

    Given a data set obtained under fixed conditions, random scatter will occur in the data

    values. There exist a number of statistical techniques for the analysis of such a data set.

    These techniques provide an effective model for the interpretation of the data.

    The first step in analysing the data is too conduct a Least-Squares Regression Analysis.

    This allows a polynomial to be plotted against the data set. The regression analysis for a

    single variable function is given by the equation :

    (3)

    The a0 value is determined by the equation

    (4)

    The a1 value is determined by the equation

    (5)

    xi = independent variable (input data)

    yi = dependent variable (function of x)

    A histogram is needed to supply a graphical representation of the discrete set of data. This

    can then be characterized by a probability density function.

    To plot the histogram of the data set, we must first calculate the number of bins (K).

    (4)

    A Gaussian distribution is plotted on the same graph with equal standard deviation and

    mean values. This is used to compare and contrast between the Normal Gaussian

    distribution and the histogram obtained from the dataset.

    The Gaussian distribution is given according to the equation:

    (5)

  • 8/2/2019 Lab Report Data Analysis

    5/13

  • 8/2/2019 Lab Report Data Analysis

    6/13

    Results

    1 M 0 DEGREES

    1 M 15 DEGREES

    2 M 0 DEGREES

    2 M 15 DEGREES

    1.04 1.06 1.08 1.1 1.12 1.14 1.16 1.18 1.20

    100

    200

    300

    400

    500

    600

    700

    y(m)

    count

    95% interval = 1.1014 to 1.1495

    Estimated mean = 1.1254 to 1.1256

    Estimated variance = 0.000142

  • 8/2/2019 Lab Report Data Analysis

    7/13

    4 M 0 DEGREES

    4 M 15 DEGREES

    1.95 2 2.05 2.1 2.15 2.2 2.25 2.3 2.350

    50

    100

    150

    200

    250

    300

    y(m)

    count

    95% interval = 2.0203 to 2.2430

    Estimated mean = 2.1311 to 2.1323

    Estimated variance = 0.003008

  • 8/2/2019 Lab Report Data Analysis

    8/13

    Conclusion

  • 8/2/2019 Lab Report Data Analysis

    9/13

    Discussion

  • 8/2/2019 Lab Report Data Analysis

    10/13

    Appendix

    %%%Giving a choice to select a file from a list[fn,pn,bn] = uigetfile('*.mat');

    % Checking if a file is selected and loads itif bn>0

    load(fn);end%%%Angles in radians

    [h,w] = size(X.Scans);q = linspace(0,pi,w);

  • 8/2/2019 Lab Report Data Analysis

    11/13

    %Conversion to cartesianfor k = 1:h

    x(k,:) = X.Scans(k,:).* cos(q);y(k,:) = X.Scans(k,:).* sin(q);

    end

    %%% Plotting of the data scansfig(1) = figure('units','normalized','position',[rand*0.1+0.4 rand*0.1+0.40.35 0.35],'color','w');plot(x,y,'b.');xlabel('x(m)');ylabel('y(m)');axis([-4 4 0 8]);

    %%z1 = find(fn=='m');z2 = find(fn=='d');deg = fn(z1(1) + 1:z2(1) - 1);set(gcf, 'name', sprintf('Object Inclination = %s(deg)', deg));

    %% Make the data select optionwaitforbuttonpress;p1 = get(gca,'CurrentPoint');finalRect = rbbox;p2 = get(gca,'CurrentPoint');title('');p1=p1(1,1:2);p2=p2(1,1:2);if sum(p1==p2)>1,%no selectiontitle('No data selected');returnend;

    x1 = p1(1,1);y1 = p1(1,2);x2 = p2(1,1);y2 = p2(1,2);

    %selects the min and max x n yx2min = min(x1,x2);x2max = max(x1,x2);y2min = min(y1,y2);y2max = max(y1,y2);

    % Indices for the point inside the selectionz= find((x>x2min & xy2min & y

  • 8/2/2019 Lab Report Data Analysis

    12/13

    K = 1.87 * ((N-1)^0.4) + 1;% Limits of the data to be plottedy2min = min(yss);y2max = max(yss);zy = linspace(y2min,y2max,K);%Plots the histogram and Stairs

    [hy,iy] = hist(yss,zy); hold on;stairs(iy,hy);

    %Selected data meany2mean = mean(yss);%Selected data Standard Deviationy2stdev= std(yss);%Normal distribution of the selected dataGy = normpdf(iy,y2mean,y2stdev); Gy= Gy/sum(Gy) * N;%Plotting normal distributionplot(iy,Gy,'r');xlabel('y(m)');ylabel('count');

    %Generate t tablesPr = 0.95; t = 1- (1-Pr)/2; v = N-1; tt=tinv(t,v);

    % Sxbar Defined hereSxbar = y2stdev/ sqrt(N);

    % High low pair of confidence intervalConf_intev1 = y2mean + 2 *y2stdev;Conf_intev2 = y2mean - 2* y2stdev;

    % range of the estimated means

    Rmean1 = y2mean + t* Sxbar;Rmean2 = y2mean - t* Sxbar;

    % Generating the vertical axis indices from norm distribution[xx ind]= min(abs(iy-Rmean1));[xx2 ind2]= min(abs(iy-Rmean2));

    % Plotting the estimated mean and confidence intervalplot(Conf_intev1,0,'bd',Conf_intev2,0,'bd','MarkerFaceColor','b');plot(Rmean1,Gy(ind),'b^',Rmean2,Gy(ind2),'b^','MarkerFaceColor','r');

    % Interval of varianceclimit_1 = (1-Pr)/2; climit_1 = chi2inv(climit_1,K-1);climit_2 = 1 - (1-Pr)/2 ; climit_2 = chi2inv(climit_2,K-1);

    % Goodness Fitchi = sum((hy-Gy).^2./Gy);cfit_1 = (1-Pr)/2; cfit_1 = chi2inv(cfit_1,N-1);cfit_2 = 1 - (1-Pr)/2; cfit_2 = chi2inv(cfit_2,N-1);

    % Estimated range of variancecv_1 = ((N-1) * (y2stdev^2)) / cfit_1;cv_2 = y2stdev^2;cv_3 = ((N-1) * (y2stdev^2)) / cfit_2;

    %checking chi of the datapoints to be within chi values with 95% confidenceif chi < climit_1 || chi > climit_2answer = 'REJECT';

  • 8/2/2019 Lab Report Data Analysis

    13/13

    elseanswer = 'ACCEPT';

    end

    % Sorting for printing on the screenConf_intmin = min(Conf_intev1,Conf_intev2);

    Conf_intmax = max(Conf_intev1,Conf_intev2);Rmean_min = min(Rmean1,Rmean2);Rmean_max = max(Rmean1,Rmean2);A = [cv_1, cv_2, cv_3];RVar = sort(A);title(sprintf('95%% interval = %2.4f to %2.4f \n Estimated mean = %2.4f ...to %2.4f\n Estimated variance = %2.6f