clear;
close;
clc;
% Struktura obsahujici data prime ulohy
eq = defHCEQ();
eq.c = @(x,y,t,T) 730*(2000+110000*exp(-((T-22).^2)/1.05));
eq.p = @(x,y,t) 0.2;
eq.q = @(x,y,t,T) 0;
eq.g = @(x,y,t,T) 0;
% Okrajove podminky
eq.beta{1} = @(x,y,t,T) 0;
eq.f{2} = @(x,y,t) 10;
eq.beta{3} = @(x,y,t,T) 0;
M=5e5;
eq.beta{4} = @(x,y,t,T) (M*t/3-2*M/3).*(t > 2 & t < 5)+(-M*t/3+8*M/3).*(t >= 5 & t < 8);
eq.beta{4} = @(x,y,t,T) (M).*(t >= 2 & t <= 5);
eq.neum_edge = [1,3,4];
eq.dir_edge = [2];
% Dalsi parametry
eq.stationary = false;
eq.linear = false;
eq.time = [0, 10];
eq.num_tsteps = 50;
eq.phi = @(x,y) 10+0*x+0*y;
[U,t] = ODE(eq,[],[],false);
PLOT(U,t,eq,'plots/nonstationary_ode',false);
% Ulozeni prubehu teploty v jednom bode
[T,t] = INTERPOLATE(eq,U,t,[0.01,0.5],true,'ihcp_data/nonlinear');
scatter(t,T);
% Data inverzni ulohy
ihcp = defIHCP('ihcp_data/nonlinear',eq);
ihcp.num_sensor = 1;
ihcp.eq = eq;
ihcp.ind_edge = 4;
ihcp.location = [0.01,0.5];
[q,t] = BECK(ihcp,3);
MSE = EVALUATE(q,t,[],[],eq.beta{4},[0 10],'plots/inverse_linear','Sekvenční algoritmus',[]);