T = readtable('C:\Users\User\Documents\SDS00003.CSV');
x=T.CH1;
y=downsample(x,40);
a=1;
b=[1/5 1/5 1/5 1/5 1/5];
%y=filter(b,a,y);
tim1=(0:0.0001:3.9999);
tim2=(0:0.004:3.9999);
figure(1)
subplot(4, 1, 1)
plot(tim1(1000:39999), x(1000:39999))
title('Transimpedance Amplifier Output');
xlabel('Time,[s]');
ylabel('Voltage, [v]');

a=1;
b=[1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17];
y1=filter(b,a,y);
y=y-y1;


T = readtable('C:\Users\User\Documents\SDS00004.CSV');
x=T.CH1;

subplot(4, 1, 2)
plot(tim1(1000:39999), x(1000:39999))
title('Instrumentation Amplifier Output');
xlabel('Time,[s]');
ylabel('Voltage, [v]');
% y=downsample(x,40);
% a=1;
% b=[1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17 0 0 0 0 1/17];
% y1=filter(b,a,y);
% y=y-y1;

T = readtable('C:\Users\User\Documents\SDS00005.CSV');
x=T.CH1;

subplot(4, 1, 3)
plot(tim1(1000:39999), x(1000:39999))
title('50Hz Active Filter Output');
xlabel('Time,[s]');
ylabel('Voltage, [v]');


subplot(4, 1, 4)
plot(tim2(100:1000), y(100:1000))
title('Transimpedance Amplifier Output Filtered by Filter DxN (5x17)');
xlabel('Time,[s]');
ylabel('Voltage, [v]');


size(y)

size(x)

