close all;
clear all;

load data/S.dat; % (ファイルから S を読み込むように変更 2007.10.22)
%S = 32

load data/nominal.mat; % 次数 n を読み込む
load data/simu_shift_binary.dat;
load data/result.dat;

% for u
figure(1);
plot(simu_shift_binary(:,1), simu_shift_binary(:,2), 'r', result(:,1), result(:,4)*S*512./5, 'g', simu_shift_binary(:,1), simu_shift_binary(:,2) - result(:,4)*S*512./5, 'b');
legend('simulation for PIC', 'experiment by PC', 'error');
title('u');
axis([0, 10, -32768, 32768]);

% for x[i]
for i=0:n-1
  figure(i+2);
plot(simu_shift_binary(:,1), simu_shift_binary(:,i+3), 'r', result(:,1), result(:,i+7)*S*512./5, 'g', simu_shift_binary(:,1), simu_shift_binary(:,i+3) - result(:,i+7)*S*512./5, 'b');
  legend('simulation for PIC', 'experiment by PC', 'error');
  title(strcat('x[',num2str(i),']'))
  axis([0, 10, -32768, 32768]);
end
