-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExampleF.m
More file actions
58 lines (54 loc) · 1.87 KB
/
Copy pathExampleF.m
File metadata and controls
58 lines (54 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
close all
clear all
% Add directory to current path
addpath('..')
% Parameters
n = 100-1; % Number of interfaces
sigma = ones(n+1,1); % Diffusivities
for j=1:n+1;
sigma(j)=sqrt(1.1+sin(j));
end
xj = linspace(0,1,n+2);
xj = xj(2:n+2); % Location of interfaces
u0 = @(x) x; % Initial condition
beta = [0, 1, 1, 0]; % Boundary conditions
f1 = @(t) 0.; % RHS Boundary condition
f2 = @(t) 0.; % LHS Boundary condition
tspan = [0.1,0.3,5.]; % Times at which to compute solution
options.NX = 15; % Number of places to evaluate solution
options.NN = 10; % Integration bounds
options.Ny = 200; % Number of points to use in integration
H = .5*ones(1,n); % Contact coefficients
tic
[u,xf] = UTM_Heat(n,sigma,xj,u0,beta,f1,f2,tspan,'Imperfect',H, options);
toc
% Plot
figure;
for i = 1:n+1,
plot([xj(i),xj(i)],[min(min(u))-.1,max(max(u))+.1],'Color',[0.9,0.9,0.9])
hold on
end
for j=1:length(tspan)
plot(xf,u(:,j),'r-','LineWidth',2.0)
end
axis([0,1,0,1.1])
xlabel('$x$','Interpreter','LaTeX','FontSize',20)
ylabel('$u(x,t)$','Interpreter','LaTeX','FontSize',20)
set(gca,'FontSize',14,'Layer','top')
saveas(gcf,'ExF.pdf')
for j=1:length(tspan)
figure
for i = 1:n+1,
plot([xj(i),xj(i)],[min(min(u))-.1,max(max(u))+.1],'Color',[0.9,0.9,0.9], 'LineWidth',1.)
hold on
end
plot(xf,u(:,j),'r-','LineWidth',2.0)
axis([0,1,0,1.1])
xlabel('$x$','Interpreter','LaTeX','FontSize',20)
ylabel('$u(x,t)$','Interpreter','LaTeX','FontSize',20)
title(['$t=$ ',num2str(tspan(j))],'Interpreter','LateX','FontSize',20)
set(gca,'FontSize',14,'Layer','top')
filename=['ExF_t', num2str(tspan(j))];
filename(filename==['.'])=[];
saveas(gcf,[filename '.pdf'])
end