%function plot_teste( file_name,pause_time )

pause_time=40
0;
file_name='acel_teste3_vel_50_1.mat'

load(file_name)

screan=get(0,'ScreenSize')
 
t1=figure('Position',[1 1 screan(3)/2 screan(4)/2],'doublebuffer','on')
plot(a)
title('a');
t2=figure('Position',[1 screan(4)/2 screan(3)/2 screan(4)/2])
plot(b)
title('b');
t3=figure('Position',[screan(3)/2 1 screan(3)/2 screan(4)/2])
plot(c)
title('c');
t4=figure('Position',[screan(3)/2 screan(4)/2 screan(3)/2 screan(4)/2])
plot(d)
title('d');

%pause(pause_time)
%close(t1,t2,t3,t4)

% figure
% %plot(abs(fft(a(:,1))),'.')
% stem(abs(fft(a(:,1))))
% 
% f = [0 0.15 0.2 1]; m = [1 1 0 0];
% b = fir2(20,f,m);
% [h,w] = freqz(b,1,1000);
% figure
% plot(f,m,w/pi,abs(h))
% legend('Ideal','fir2 Designed')
% title('Comparison of Frequency Response Magnitudes')

% a_f=[exp(j*pi/6) exp(-j*pi/6)];
% b_f=[exp(j*pi/5) exp(-j*pi/5)];
% aa=poly(a_f); bb=poly(b_f);
% c=conv(aa,bb);
% w=-pi:0.001:pi;
% H=freqz(c./sum(c),1,w);
% plot(w,abs(H));
% figure;
% plot(w,20*log(abs(H)));
% figure;
% plot(w,angle(H));

% figure
% a1=filter(b,1,a(:,1));
% a2=filter(b,1,a(:,2));
% a3=filter(b,1,a(:,3));
% a4=filter(b,1,a(:,4));
% % a1=mean(a(:,1)',1);
% % a2=mean(a(:,2)',1);
% % a3=mean(a(:,3)',1);
% % a4=mean(a(:,4)',1);
% % a5=[a1' a2' a3' a4']
% a5=[a1 a2 a3 a4];
% plot(a5)
% title('a');

d_d=1;
while(d_d~=5)

if (d_d==1)
    s=a(:,1);
end
if (d_d==2)
    s=a(:,2);
end
if (d_d==3)
    s=a(:,3);
end
if (d_d==4)
    s=a(:,4);
end
end    

filt_1=s(1);
flit_2=s(1);
flit_3=s(1);
flit_4=s(1);

for i=4:length(s)
    
    new_s=(s(i)+s(i-1)+s(i-2)+s(i-3)+s(i-4))/4
end
figure
plot(new_s);
    
% max_y=s(1);
% min_y=s(1);
% prev_y=s(1);
% 
% new_s=[];
% for i=1:length(s)
%     
%     y=s(i);
%     
% %     if (i>1)
% %         y=(y+new_s(end))/2;
% %     end
%     
%     if (y>max_y)
%         new_y=max_y;
%     elseif (y<min_y)
%         new_y=min_y;
%     else
%         new_y=y;
%     end
%     
%     if (y>prev_y)
%         max_y=y;
%         min_y=prev_y;
%     else
%         max_y=prev_y;
%         min_y=y;
%     end
%     
%     prev_y=y;
%      
%     
%     max_y=prev_y;
%     min_y=prev_y;
%     prev_y=prev_y;
%     
%     y=prev_y;
%     
%     if (y>max_y)
%         new_y=max_y;
%     elseif (y<min_y)
%         new_y=min_y;
%     else
%         new_y=y;
%     end
%     
%     if (y>prev_y)
%         max_y=y;
%         min_y=prev_y;
%     else
%         max_y=prev_y;
%         min_y=y;
%     end
%     
%     prev_y=y;
%     
% %     if (i>1)
% %         new_y=(new_y+new_s(end))/2;
% %     end
% 
%     new_y=(new_y+new_y)/2
%     new_s(i)=new_y%[new_s new_y]
%     
%     
%     
% end
% 
% d_d=d_d+1;
% figure
% plot(new_s);
% 
% end
