S&S_Final Project
S&S_Final Project
My final project is about a classical game from Aesop's Fables,I make it by the matlab software.
The matlab can support smartphone to send message of acceleration、magnetic field、orientation、position. Among of these function, I use acceleration identification to carry out this project.
Final Project Video
What the user should do is rotating his smartphone, the right side represent rat, the left side represent elephant and the up side represent cat. And then,the program will show the result.it will run five times.
The cat can kill rat,the rat can kill elephant,and the elephant can kill cat.
Simulink & Stateflow Figure↓
Final Project Code:
clear all;
m = mobiledev
w1=0;
for n=1:5
q=randi(3);
if q==1
pic=imread('1.png');
elseif q==2
pic=imread('2.png');
elseif q==3
pic=imread('3.png');
end
image(pic)
pause(1);
m.Logging = 1;
pause(2);
m.Logging=0;
[ac, tac] = accellog(m);
xac = ac(:,1);
x=xac(end);
zac = ac(:,3);
z=zac(end);
load_system('lee1');
sim('lee1');
a=w(end);
if a==1
pic=imread('4.png');
elseif a==0
pic=imread('5.png');
elseif a==-1
pic=imread('6.png');
end
image(pic);
pause(1);
end