Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- close all; clear all; clc;
- load EMGData.txt
- emg = EMGData(:,1);
- [b,a]=butter(4,4/(960/2),'low');
- n = length(a);
- z(n) = 0;
- Y = zeros(size(X));
- for m = 1:length(Y)
- % disp(['b(0): ' num2str(b(1))]);
- % disp(['X(m): ' num2str(X(m))]);
- % disp(['z(0): ' num2str(z(1))]);
- Y(m) = b(1) * X(m) + z(1);
- % disp(['Y(m)=b(0)*X(m)+z(0) : ' num2str(Y(m))]);
- for i = 2:n
- % disp(['for i=' num2str(i-1)]);
- % disp([' b(' num2str(i-1) '):' num2str(b(i))]);
- % disp([' X(m):' num2str(X(m))]);
- % disp([' z(' num2str(i-1) '):' num2str(z(i))]);
- % disp([' a(' num2str(i-1) '):' num2str(a(i))]);
- % disp([' Y(m):' num2str(Y(m))]);
- z(i - 1) = b(i) * X(m) + z(i) - a(i) * Y(m);
- % disp(['Z(' num2str(i-2) ')=b(i)*X(m)+z(i)-a(i)*Y(m):' num2str(z(i-1))]);
- end
- % disp('--------------------------------------');
- end
- z = z(1:n - 1);
- figure
- plot(X)
- hold on
- plot(Y,'LineWidth',3,'Color','black')
- axis tight
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement