load outputfile.mat;

time = outputdata(1,:);
i_f = outputdata(2,:);
psi_d = outputdata(3,:);
psi_q = outputdata(4,:);
v_q = outputdata(5,:);
number = length(time);

subplot(2,1,1)
plot(time,i_f,'b-');
axis([-5 40 0.5 1.0]);
grid on;
xlabel('Time (seconds)');
ylabel('Field Current (Ampers)');
title('Field Current vs. Time','FontSize',12);

subplot(2,1,2)
plot(time,psi_d,'r-');
axis([-5 40 0.5 1.1]);
grid on;
xlabel('Time (seconds)');
ylabel('D-axis Flux Linkages (Webers)');
title('D-axis Flux Linkages vs. Time','FontSize',12)

OPF = fopen('file1.dat','w');

for n=1:number
 fprintf(OPF,'%5.3f   %5.3f   %5.3f \n',time(n), i_f(n), psi_d(n));
end;

fclose(OPF);