Friday, June 10, 2011

Bilinear Interpolation in Matlab

Bilinear Interpolation in Matlab
(Applied Mathematics)

%3-D interpolation for the use of fuel maps in Engine Control Units (ECUs)
%Develped by Ransalu Senanayake (20-03-2011)
%HELP: fmap(desired_x_value, desired_y value)
function[]=fmap2(realx,realy)
help fmap2

nearx=realx-rem(realx,10);
neary=realy-rem(realy,10);
x=0:10:100;
y=0:10:100;
xval=find(x==nearx);
yval=find(y==neary);

%ploting the fuel map - Assuming desired map is given by z
x=0:10:100;
y=0:10:100;
[X,Y]=meshgrid(x,y);
z=X.*exp(-(X/60).^2-(Y/60).^2);
Z=(z)*100/max(max(z(:)));
surf(X,Y,Z)
view([0 0 180])
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')
title('Fuel Map')

%4 neighbours
x1y1=Z(yval,xval);
x2y1=Z(yval,xval+1);
x1y2=Z(yval+1,xval);
x2y2=Z(yval+1,xval+1);
appears_as=[x1y2 x2y2;x1y1 x2y1]

%finding zy
zy1=((nearx+10-realx)*x1y1+(realx-nearx)*x2y1)/10;
zy2=((nearx+10-realx)*x1y2+(realx-nearx)*x2y2)/10;
zy=((neary+10-realy)*zy1 + (realy-neary)*zy2)/10;

%matlab interpolation
m=0:1:100; n=0:1:100;
[M,N]=meshgrid(m,n);
P=interp2(X,Y,Z,M,N);
%figure, mesh(M,N,P)
Matlab_ans = P(realy+1,realx+1);

%calculating errors
answer_is=zy;
answer_shoud_be=realx*exp(-(realx/60)^2-(realy/60)^2)*100/max(max(z(:)));
my_percentage_error=100*(answer_shoud_be-answer_is)/(max(appears_as(:))-min(appears_as(:)));
Matlab_percentage_error=100*(answer_shoud_be-Matlab_ans)/(max(appears_as(:))-min(appears_as(:)));

%console display
disp(['Answer should be: ',num2str(answer_shoud_be)]);
disp(['My Answer is: ',num2str(zy), ' with error: ',num2str(my_percentage_error),'%'])
disp(['Matlab Answer is: ',num2str(Matlab_ans), ' with error: ',num2str(Matlab_percentage_error),'%'])

Hand Gesture Recognition

VISION BASED HAND GESTURE RECOGNITION SYSTEM FOR APPLIANCE CONTROL IN SMART HOMES
Stage 01
http://www.youtube.com/watch?v=u3FfN3I97d0

Will be available in the future....

*Biological, Mathematical, Electrical and Computer Modelling of a Central Nervous System Based Neuron
*Completed version of Hobby Robots
*Vision based skin segmentation
*Vision based gesture recognition

Sunday, May 15, 2011

Perceptron Based Classification in Matlab

Perceptron Based Classification in Matlab
(Artificial Intelligence)

Fixed increment perceptron learning algorithm for classifying two classes based on two features.

Hobby Robots

(Robotics)

Section 1: Introduction to robotics
1.1 Who a robot is
1.2 Types of Hobby robots
1.3 The line following robot
Section 3: Wheels
2.1 Types of wheels
2.2 Wheel Configurations
2.3 Robot turning mechanisms
Section 3: Motors
3.1 Motors for hobby robots
3.2 Motor Drivers
Section 4: Sensors
4.1 Types of sensors
4.2 Application of Sensors
Section 5: Power Supply
Section 6: Structure
Section 7: Microcontroller Programming
Section 8: An Example Design

Spatial Domain Correlation in Matlab

Spatial Domain Correlation in Matlab
(Digital Signal Processing)