%------------------------------------------------------------
% Tony Hyun Kim
% 6.638 PS2 Problem 1b
%   Propagation of solitons using NSE, Display Results
%------------------------------------------------------------
close all;

[T Z] = meshgrid(t,z);

% Find submatrix corresponding to desired display range
trange = [-10 10];
[m low]  = find(trange(1)<t,1);
[m high] = find(trange(2)<t,1);
clear m;
Tsub = T(:,low:high);
Zsub = Z(:,low:high);
Usub = U(:,low:high);

subplot(121);
mesh(Tsub,Zsub,Usub);
set(gca,'YDir','reverse');
xlim(trange);
xlabel('Time \tau');
ylabel('Propagation distance \zeta');
% view(0,90);
clear T Z Tsub Zsub Usub;

subplot(122);
frange = [-1 1];
[m low]  = find(frange(1)<f,1);
[m high] = find(frange(2)<f,1);
[F Z] = meshgrid(f,z);
clear m;
Fsub = F(:,low:high);
Zsub = Z(:,low:high);
Ufsub = Uf(:,low:high);

mesh(Fsub,Zsub,Ufsub);
set(gca,'YDir','reverse');
xlim(frange);
xlabel('Frequency 1/\tau');
ylabel('Propagation distance \zeta');
% view(0,90);
clear F Z Fsub Zsub Ufsub;