% This function returns the filtered responsedata

%written by: Knut Åge Meland
%email: knutagemeland@gmail.com

%%
function filtered_var = filterplotter(t, P, order, cutoff)

[B,A] = butter(order,cutoff); 
filtered_var=filter(B,A,P);

plot(t,filtered_var,':r')
%title('Filterd data')
xlabel('Time[s]')
ylabel('Gauge pressure[kPa]')
%figure
% 
% subplot(211)
% plot(t,filtered_var);
% axis([0 max(t) min(P) max(P)]);
% 
% subplot(212)
% plot(t,P);
% axis([0 max(t) min(P) max(P)]);

%figure
