-
Notifications
You must be signed in to change notification settings - Fork 0
/
Convergence_Stability_Monotonicity.m
70 lines (56 loc) · 1.59 KB
/
Convergence_Stability_Monotonicity.m
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
59
60
61
62
63
64
65
66
67
68
69
70
%{
The Implicit Method
==========================================
Application: PDE of riksy asset (St) of Wang(1996)'s paper
We want to solve: 2nd-order PDE of S with exogenous state var Y
where Y ~ GMB
-I use forward and backward approx: SY
-I change the sign of St (\partial S / \partial t): to start from t0
: same result: inverse U-shape of S
- Boundaries in S(n+1): the correct to do that is to substitute Eq1 and EqI+1 by
Boundaries conditions
----------------------------
Author: Hamilton Galindo Gil
Date: 2024 (Nov)
Paper base: Wang(1996)
----------------------------
%}
%=========================================
clear; clc;
close all;
%% Run the main m-file
run G_Main_PDE_S2F.m
iterationsV = 1:n;
%% Monotonicity
irange=1:I+1;
% Graph
figure('Name','Conv-Sta-Mono')
subplot(2,3,1)
plot(dist,'LineWidth', 1.5)
title('Convergence')
xlabel('Iterations (n)')
ylabel('$||S^n - S^{n-1} ||$')
grid;
subplot(2,3,2)
plot(error,'LineWidth', 1.5)
title('Stability')
xlabel('Iterations (n)')
ylabel('$L_2$ Error Norm')
grid;
subplot(2,3,3)
%yyaxis left
plot(irange, -X,'b',...
irange, -Z, 'r--','LineWidth', 1.5)
%yyaxis right
%plot(irange, -(1/deltat)*ones(I+1,1),'LineWidth', 1.5)
title('Monotonicity')
xlabel('Grid Points ($i$)')
%ylabel('$-X_i$ and $-Z_i$')
legend('$-X_i$', '$-Z_i$')
grid;
% Save the figure
h=gcf;
set(h,'PaperOrientation','landscape');
set(h,'PaperUnits','normalized');
set(gcf,'PaperPosition', [0 0 1 1]);
print(h, '-dpdf', strcat('P1','_FigCSM.pdf'));