function hhplot(tfinal, state)

%This code solves the Hodgkin-Huxley equations from t=0 to
%t=tfinal, then plots the output.

% temporal resolution (nothing to do with ODE solver time
% step)
dt = 0.1;

% solve
t = 0:dt:tfinal;
y = hhsolve(t, state);


% plot
figure(1);
clf;

subplot(4,1,1);
plot(t, y(:,1));
xlabel('t');
ylabel('V');

subplot(4,1,2);
plot(t, y(:,2));
xlabel('t');
ylabel('m');

subplot(4,1,3);
plot(t, y(:,3));
xlabel('t');
ylabel('h');

subplot(4,1,4);
plot(t, y(:,4));
xlabel('t');
ylabel('n');
