Neural network to control prosthesis
Show older comments
Hey guys , I'm a student of biomedical engineering, and i need some help.
I'm doing a project that controls a prothesis simulated in Unity by EMG signals.
First , to train the network , I have collected 30 EMG signals , with two channels (biceps and triceps) ,from 7 moviments. then i need to use a neuralnetwork with backpropagation to determinate what moviment the person is doing in real time.
From each signal i have calculated 10 features , 5 from each signal. they are : Mean Absolute Value , Mean Absolute Value Slope , Zero Crossing , Slope Sign Changes and Waveform Length.
So , my features vector to be the input in the training is the attached file 'caracteristicas.mat'.
My network output will be size 7, each being a moviment, and my input will be size 10 . i tryed to train the network using 20 of the 30 signals, and use the others 10 to test the simulation . I made this code :
clear all
close all
clc
load('../caracteristicas.mat');
indice = [1,20;31,50;61,80;91,110;121,140;151,170;181,200];
T = [1,0,0,0,0,0,0;0,1,0,0,0,0,0;0,0,1,0,0,0,0;0,0,0,1,0,0,0;0,0,0,0,1,0,0;0,0,0,0,0,1,0;0,0,0,0,0,0,1;];
net = newff([min(carac')' max(carac')'],[10 8 7],{'tansig' 'purelin' 'logsig'},'traingd');
net.trainParam.epochs = 100;
for i = 1:7
net = train(net,carac(indice(i,1):indice(i,2),:),T(i,:));
end
a = sim(net,carac(21,:))
Any one knows what I'm doing wrong ?
I get the following error : " Error using network/train (line 340) Inputs and targets have different numbers of samples.
Error in rede (line 10) net = train(net,carac(indice(i,1):indice(i,2),:),T(i,:)); "
How can i use the backpropagation in this code ? Can anyone help me?
1 Comment
Greg Heath
on 30 Jun 2015
Train on matrices, not matrix components.
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!