% Example 3.17
% use NonlinearSFSM_h with noisy data 
load Example3_15_data;  % contains 'time' and 'T_5pct' (noisy data)
Y = T_5pct;
dt = time(2) - time(1);
N = length(Y);
Tinf = 1.0;
x = 0.5;
rvec = [ 3 4 5];  % values of r to consider
legstr = [ "ro", "bd", "ks" ];
 
nr = length(rvec);
hhat = zeros(N, nr);
 
figure(99); clf; hold on
 
for ir = 1:nr
    r = rvec(ir);
    [hhat(:,ir),Tsur,That] = NonlinearSFSM_h( dt, x, r, Y, Tinf );
    plot( time(2:N-r), hhat(2:N-r,ir), legstr(ir), 'linewidth', 1.0, 'DisplayName', sprintf('r =%2d',r) )
end
load('hexact_triangle_01.mat');  % contains 't' and 'hexact_tri' 
plot( t01, hexact_tri, 'k--', 'linewidth', 1.0, 'DisplayName', 'Exact' );
xlabel('time'); ylabel('Heat Transfer Coefficient');
legend show
 
%     fig = figure(99);
%     print(fig,fullfile(pwd, 'Figure3_21.tif'),'-dtiff','-r600')

