% Lämpöyhtälön numeriikkaa
% 15.3.05 HA   /p/edu/mat-1.192/LYdiffBesim.m


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Cooper s. 127 tehäviä
%   Sovelletaan LYdiffB-funktiotamme
% Teht. 11

help LYdiffB
f=inline('(x>0 & x<5).*x + (x>=5 & x<=10 ).*(10-x)','x')
g=inline('zeros(size(t))','t');
% g=inline('0','t')  ei ole "array smart"
fplot(f,[0,10])

nx=60; nt=100; dt=0.05;
vali=[0 10];
[x,t,U]=LYdiffB(f,g,g,vali,nx,nt,dt);
figure(1), clf, surfc(x,t,U)
xlabel('x');ylabel('t');zlabel('lämpötila u')


snap1=find(t==1)
plot(x,U(snap1,:))

