/4,
(not
2/4). The correct value for h should be between
0 and 1 (since h=1 means that the tank is half full).
/4
. Use trial and error to find the five different values for v.
hermite.m for Hermite interpolation,
example for Hermite, complete spline, not-a-knot
splinenum2bin.m
and bin2num.m (note that you
have to put the files where
Matlab can find them)norm(x,1) ,
norm(x,2) , norm(x,inf) cond(A,1),
cond(A,2), cond(A,3) (in all cases
inv(A) is computed) estimate for
cond1(A): condest(A) (computes LU
decomposition of A) If decomposition A=L1 U is already
computed, use condestdec(L1,U) condestdec.m ,
for Matlab 5 use condestdec5.m
instead)[L1,U] = lu(A); % compute
factorization A=L1 U using Gaussian elimination with pivoting,
choosing pivot candidates with largest absolute valuey = L1\b; % "forward substitution"
x = U\y; % back susbstitution
condition = condestdec(L1,U) %
estimate condition number of A (for 1-norm)x contains the x-coordinates of the nodes, the column
vector y contains the function values at the nodes, the
vector yp contains the derivatives at the nodes. The vector
xi contains the points where we want to evaluate the
interpolating function, the vector yi contains the
corresponding values of the interpolating function.
hermite.m . Then use yi =
hermite(x,y,yp,xi)yi =
spline(x,[yp(1);y;yp(end)],xi) yi =
spline(x,y,xi)Example: Complete cubic spline for sin(x) using nodes 0, pi/2, pi, 3*pi/2, 2*pi:
x = [0; pi/2; pi; 3*pi/2; 2*pi]use 100 points in interval [0,2*pi] for plotting
y = sin(x)
xi = linspace(0,2*pi,100); %f'(0)=1, f'(2*pi)=1
yi = spline(x,[1;y;1],xi); %
plot(x,y,'o',xi,sin(xi),'--',xi,yi)
legend('data points','exact function','complete cubic spline')
[Q,R] = qr(A,0)
d = Q'*y
c = R\d
c = A\y Course outline handed out in the first class: Information about time & place, instructor, textbooks, syllabus, grading policy, Matlab assignments, final exam.
For each problem, all the commands which produce the numerical results and graphics have to be put in an m-file. Printouts of interactive input at the Matlab prompt will not be accepted! All output and graphics must be clearly labeled; only print out values which were asked for in the problem.
For each problem you must hand in
;'' at the end of lines to suppress the output of
uninteresting intermediate results (especially if these are large
arrays).disp or fprintf commands to for text output,
see examples. Use the
title, xlabel, ylabel,
legend commands to label your graphs, see example.print -dps figXY.ps in Matlab produces a postscript file
figXY.ps of the current figure which you can then send to the
printer.) tap
matlab and then matlab & . This
starts the integrated enviroment (with editor and debugger). matlab
-nojvm . In this way you can also use Matlab remotely (but
you won't see any graphs unless you have an X-server running on your
local machine). You can use your favorite editor (nedit,
pico,
vi, emacs) for
writing m-files.