From: Debora on
Just in case is the commands...

here is where I am so far:


% Tentantiva de aprender a trabalhar com emg no matlab
% 30 de julho de 2010

clear all
close all

%load emg file
[diretorio,file]=carrega('*.prn');
a=lesad(diretorio,file);
y=a(:,2); %remove frames comlumn

%remove DC
mediaemg=mean(y);
m=y-mediaemg;
y=m;

% define N for fft
[nl,nc]=size(y);

n=0;
h=1;
while h>=1;
n=n+1;
h=nl/2^n;
end

% FFT

x=fft(y(:),2^n-1);
z=x.*conj(x)/2^n-1;

[nnl,nnc]=size(z);

%plot fft
g=2000*(0:nnl/2)/nnl;
figure(1),plot(g(1:end-1),(z(1:nnl/2)));

% butt = 20;
% def = {num2str(butt),'hsv'};
% massa_s = inputdlg('Linha 1: freq baixa, Linha 2: freq alta, Linha 3: ordem','Massa corporal',3,def);

%Filter

[b,c] = butter(3,2*20*(1/2000),'high');
result1 = filtfilt(b,c,z);

[d,e] = butter(3,2*500*(1/2000),'low');
result2 = filtfilt(b,c,result1);

Debora