pwd
ans =
\\nask.man.ac.uk\home$\MATLAB
ls
. limited_data_app.fig
.. limited_data_app.m
140311.txt makemat.m
20032014.txt myf.m
28-Jan-2015.txt myfirstmodel.mdl
PLL mymfile.m
deriv2.m nag_lsqcurvefit.m
diary-06-03-2013.txt nag_lsqcurvefit_aux.m
diary-13-3-2-2013.txt opttest.m
figjunk.fig ray_tracer_2d.m
figjunk.m rubbish.fig
heat.m rubbish.m
ilaplace.m siddon.m
junj.fig sinc.m
junj.m startup.m
junkgraph.fig test.wav
junkgraph.m testwalk.m
kaczmarz.m
landweber.m
help ilaplace
ilaplace Test problem: inverse Laplace transformation.
[A,b,x,t] = ilaplace(n,example)
Discretization of the inverse Laplace transformation by means of
Gauss-Laguerre quadrature. The kernel K is given by
K(s,t) = exp(-s*t) ,
and both integration intervals are [0,inf).
The following examples are implemented, where f denotes
the solution, and g denotes the right-hand side:
1: f(t) = exp(-t/2), g(s) = 1/(s + 0.5)
2: f(t) = 1 - exp(-t/2), g(s) = 1/s - 1/(s + 0.5)
3: f(t) = t^2*exp(-t/2), g(s) = 2/(s + 0.5)^3
4: f(t) = | 0 , t <= 2, g(s) = exp(-2*s)/s.
| 1 , t > 2
The quadrature points are returned in the vector t.
[A,b,x]=ilaplace(100);
plot(A*x-b)
plot(A\b)
{Warning: Matrix is close to singular or badly
scaled. Results may be inaccurate. RCOND =
7.297575e-33.}
plot(x)
cond(A)
ans =
9.9045e+31
ls
. limited_data_app.fig
.. limited_data_app.m
140311.txt makemat.m
20032014.txt myf.m
28-Jan-2015.txt myfirstmodel.mdl
PLL mymfile.m
deriv2.m nag_lsqcurvefit.m
diary-06-03-2013.txt nag_lsqcurvefit_aux.m
diary-13-3-2-2013.txt opttest.m
figjunk.fig ray_tracer_2d.m
figjunk.m rubbish.fig
heat.m rubbish.m
ilaplace.m siddon.m
junj.fig sinc.m
junj.m startup.m
junkgraph.fig test.wav
junkgraph.m testwalk.m
kaczmarz.m
landweber.m
help deriv2
deriv2 Test problem: computation of the second derivative.
[A,b,x] = deriv2(n,example)
This is a mildly ill-posed problem. It is a discretization of a
first kind Fredholm integral equation whose kernel K is the
Green's function for the second derivative:
K(s,t) = | s(t-1) , s < t .
| t(s-1) , s >= t
Both integration intervals are [0,1], and as right-hand side g
and correspond solution f one can choose between the following:
example = 1 : g(s) = (s^3 - s)/6 , f(t) = t
example = 2 : g(s) = exp(s) + (1-e)s - 1 , f(t) = exp(t)
example = 3 : g(s) = | (4s^3 - 3s)/24 , s < 0.5
| (-4s^3 + 12s^2 - 9s + 1)/24 , s >= 0.5
f(t) = | t , t < 0.5
| 1-t , t >= 0.5
[A,x,b]=deriv2(100);
cond(A)
ans =
1.2158e+04
plot(x)
plot(A\b)
a=1e-4;plot((A'*A +a*eye(100))\A'*b)
plot(x)
a=1e-8;plot((A'*A +a*eye(100))\A'*b)
a=1e-3;plot((A'*A +a*eye(100))\A'*b)
figure
plot(x)
[A,b,x]=deriv2(100);
plot(x)
plot(b)
plot(A\b)
plot(A\(b+randn(100,1))
plot(A\(b+randn(100,1))
|
{Error: Expression or statement is
incorrect--possibly unbalanced (, {, or [.
}
plot(A\(b+randn(100,1)))
b
b =
-0.0001
-0.0002
-0.0004
-0.0006
-0.0007
-0.0009
-0.0011
-0.0012
-0.0014
-0.0016
-0.0017
-0.0019
-0.0021
-0.0022
-0.0024
-0.0025
-0.0027
-0.0028
-0.0030
-0.0031
-0.0033
-0.0034
-0.0036
-0.0037
-0.0038
-0.0040
-0.0041
-0.0042
-0.0044
-0.0045
-0.0046
-0.0047
-0.0048
-0.0050
-0.0051
-0.0052
-0.0053
-0.0054
-0.0055
-0.0056
-0.0056
-0.0057
-0.0058
-0.0059
-0.0059
-0.0060
-0.0061
-0.0061
-0.0062
-0.0062
-0.0063
-0.0063
-0.0063
-0.0064
-0.0064
-0.0064
-0.0064
-0.0064
-0.0064
-0.0064
-0.0064
-0.0064
-0.0063
-0.0063
-0.0063
-0.0062
-0.0062
-0.0061
-0.0061
-0.0060
-0.0059
-0.0058
-0.0057
-0.0056
-0.0055
-0.0054
-0.0053
-0.0052
-0.0050
-0.0049
-0.0047
-0.0046
-0.0044
-0.0042
-0.0040
-0.0038
-0.0036
-0.0034
-0.0032
-0.0030
-0.0027
-0.0025
-0.0022
-0.0020
-0.0017
-0.0014
-0.0011
-0.0008
-0.0005
-0.0002
plot(A\(b+1e-5*randn(100,1)))
plot(A\(b+1e-6*randn(100,1)))
plot(A\(b+1e-7*randn(100,1)))
a=1e-3;plot((A'*A +a*eye(100))\A'*b)
a=1e-8;plot((A'*A +a*eye(100))\A'*b)
a=1e-8;plot((A'*A +a*eye(100))\A'*(b+1e-7*randn(100,1))
a=1e-8;plot((A'*A +a*eye(100))\A'*(b+1e-7*randn(100,1))
|
{Error: Expression or statement is
incorrect--possibly unbalanced (, {, or [.
}
a=1e-8;plot((A'*A +a*eye(100))\A'*(b+1e-7*randn(100,1)))