Professional Documents
Culture Documents
MMAN3210
8/25/2011
Contents
Description of Purpose And Background.......................................................................................... 3
Theoretical Basis of Data Analysis .................................................................................................... 4
Results ................................................................................................................................................... 6
Conclusion ............................................................................................................................................. 8
Discussion ............................................................................................................................................. 9
Appendix .............................................................................................................................................. 10
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 infinite
distance 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
(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)
Results
1 M 0 DEGREES
95% interval = 1.1014 to 1.1495
Estimated mean = 1.1254 to 1.1256
Estimated variance = 0.000142 <= 0.000145 <= 0.000148
Chi-sq test = 65.126825 < 99.911613 < 117.437499 <---- ACCEPT
700
600
count
500
400
300
0
-4
-3
-2
-1
200
100
0
1.04
1.06
1.08
1.1
1.12
y(m)
1.14
1.16
1.18
1.2
1 M 15 DEGREES
95% interval = 1.0291 to 1.2600
Estimated mean = 1.1441 to 1.1450
Estimated variance = 0.003259 <= 0.003333 <= 0.003408
Chi-sq test = 64.348866 < 3365.299316 < 116.390890 <---- REJECT
350
300
count
250
200
0
-4
150
-3
-2
-1
100
50
0
1.05
1.1
1.15
1.2
y(m)
1.25
1.3
1.35
1.4
2 M 0 DEGREES
95% interval = 2.0895 to 2.1766
Estimated mean = 2.1328 to 2.1333
Estimated variance = 0.000461 <= 0.000475 <= 0.000489
Chi-sq test = 49.368235 < 49.854332 < 95.876269 <---- ACCEPT
400
350
4
300
count
250
200
0
-4
150
100
50
0
2.05
2.1
2.15
2.2
2.25
y(m)
2 M 15 DEGREES
-3
-2
-1
300
250
4
200
count
2
150
0
-4
-3
-2
-1
100
50
0
1.95
2.05
2.1
2.15
y(m)
2.2
2.25
2.3
2.35
4 M 0 DEGREES
95% interval = 4.0689 to 4.2438
Estimated mean = 4.1557 to 4.1570
Estimated variance = 0.001835 <= 0.001911 <= 0.001992
Chi-sq test = 36.044044 < 92.856232 < 76.862645 <---- REJECT
300
250
4
200
count
2
150
0
-4
-3
-2
-1
100
50
4.05
4.1
4.15
4.2
4.25
4.3
4.35
y(m)
4 M 15 DEGREES
95% interval = 4.0203 to 4.3187
Estimated mean = 4.1684 to 4.1706
Estimated variance = 0.005340 <= 0.005566 <= 0.005806
Chi-sq test = 35.263962 < 145.414154 < 75.718892 <---- REJECT
250
150
100
0
-4
count
200
50
0
3.95
4.05
4.1
4.15
4.2
y(m)
4.25
4.3
4.35
4.4
4.45
-3
-2
-1
Conclusion
Discussion
Appendix
%%
%Giving a choice to select a file from a list
[fn,pn,bn] = uigetfile('*.mat');
% Checking if a file is selected and loads it
if bn>0
load(fn);
end
%%
%Angles in radians
[h,w] = size(X.Scans);
q = linspace(0,pi,w);
%Conversion to cartesian
for k = 1:h
x(k,:) = X.Scans(k,:).* cos(q);
y(k,:) = X.Scans(k,:).* sin(q);
end
%%
% Plotting of the data scans
fig(1) = figure('units','normalized','position',[rand*0.1+0.4 rand*0.1+0.4
0.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 option
waitforbuttonpress;
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 selection
title('No data selected');
return
end;
x1
y1
x2
y2
=
=
=
=
p1(1,1);
p1(1,2);
p2(1,1);
p2(1,2);
K = 1.87 * ((N-1)^0.4) + 1;
% Limits of the data to be plotted
y2min = 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 mean
y2mean = mean(yss);
%Selected data Standard Deviation
y2stdev= std(yss);
%Normal distribution of the selected data
Gy = normpdf(iy,y2mean,y2stdev); Gy= Gy/sum(Gy) * N;
%Plotting normal distribution
plot(iy,Gy,'r');
xlabel('y(m)');ylabel('count');
%Generate t tables
Pr = 0.95; t = 1- (1-Pr)/2; v = N-1; tt=tinv(t,v);
% Sxbar Defined here
Sxbar = y2stdev/ sqrt(N);
% High low pair of confidence interval
Conf_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 interval
plot(Conf_intev1,0,'bd',Conf_intev2,0,'bd','MarkerFaceColor','b');
plot(Rmean1,Gy(ind),'b^',Rmean2,Gy(ind2),'b^','MarkerFaceColor','r');
% Interval of variance
climit_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 Fit
chi = 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 variance
cv_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% confidence
if chi < climit_1 || chi > climit_2
answer = 'REJECT';
else
answer = 'ACCEPT';
end
% Sorting for printing on the screen
Conf_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 <= %2.6f <= %2.6f \n Chi-sq test ...
= %2.6f < %2.6f < %2.6f <---...
%s',Conf_intmin,Conf_intmax,Rmean_min,Rmean_max,RVar(1),RVar(2),RVar(3) ...
,climit_1,chi,climit_2,answer),'color','k');msgbox(answer,'Verify');