%Simulation of noise cancellation
% kja 070324

aminit;

% Load up the simulink model first, to get variables in place
noisecan;

% Set values of the parameters (set inside simulation)
set_param('noisecan/Band-Limited White Noise', 'Cov', '[10]')
set_param('noisecan/Signal Generator', 'Amplitude', '1')

% Run the simulation
tmax=200;
[t,x,y]=sim('noisecan',tmax);

figure(1); clf; subplot(321);
pl=plot(t,y(:,1));
set(pl, 'Linewidth', AM_data_linewidth);
ylabel('n');
amaxis([0 200 -8 8]);

subplot(323);
pl=plot(t,y(:,2));
set(pl,'Linewidth',AM_data_linewidth);
ylabel('hats');
xlabel('t');
amaxis([0 200 -8 8]);

subplot(322);
pl=plot(t,y(:,4));
set(pl,'Linewidth',AM_data_linewidth);
ylabel('a', 'Rotation', 0);
amaxis([0 200 -1 0.1]);

subplot(324);
pl=plot(t,y(:,3));
set(pl,'Linewidth',AM_data_linewidth);
ylabel('b', 'Rotation', 0);
xlabel('t');
amaxis([0 200 0 1.1]);

amprint('noisecan-sim.eps');
