Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all
- clc
- %% Original Plot
- A = xlsread('data.xlsx');
- plot(A(:,1),A(:,2));
- title('ECG Data');
- xlabel('Time(s)');
- ylabel('Amplitude(v)');
- hold on
- %% Problem 1a symmetric 3 point
- for i= 2:(length(A)-1)
- sym3(i-1) = (A(i-1,2) + A(i,2) + A(i+1,2))/3;
- end
- plot(A(2:(length(A)-1),1),sym3,'r')
- %% Problem 1b weighted symmetric 5 point
- for i = 3:(length(A)-2)
- Wsym5(i-2) = (A(i-2,2) + 2*A(i-1,2) + 3*A(i,2) + 2*A(i+1,2) + A(i+2,2))/9;
- end
- plot(A(3:(length(A)-2),1),Wsym5,'g')
- %% Problem 1c asymmetric 5 point
- for i= 1:(length(A)-4)
- asym5(i)= sum(A(i:i+4,2))/5;
- end
- plot(A(1:(length(A)-4),1),asym5,'y')
- %% Problem 1d symmetric 5 point (future values)
- for i = 3:(length(A)-2)
- sym5(i-2) = (A(i-2,2) + A(i-1,2) + A(i,2) + A(i+1,2) + A(i+2,2))/5;
- end
- plot(A(3:(length(A)-2),1),sym5,'k')
- %% Problem 1e symmetric 11 point
- for i = 6:(length(A)-5)
- sym11(i-5) = mean(A(((i-5):(i+5)),2));
- end
- plot(A(6:(length(A)-5),1),sym11, 'm')
- %% Problem 1f asymmetric 11 point (future values)
- for i = 1:(length(A)-10)
- asym11(i) = mean(A((i:i-10),2));
- end
- plot(A(1:(length(A)-10),1),asym11,'c')
- legend('original','sym3','Wsym5','asym5','sym5','sym11','asym11');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement