**This is an old revision of the document!** ----
====== homework 4 ====== ex 24.3, 26.2, 27.4, 27.5, due Friday Nov 12. ===== tips ===== **ex 24.3:** Use the matlab ''expm'' function to compute the matrix exponential. You don't need to turn in ten plots of ''||e^(tA)||'' versus ''t'', for ten different matrices, just a few that illustrate the main cases worth commenting about. **ex 26.2:** How to do contour-plot a singularity in matlab, by example. <code> % create a grid in the complex plane x = [-1:.02:1]; y = [-1:.02:1]; [X,Y] = meshgrid(x,y); Z = X + 1i*Y; % assign to W the values of 1/|z| at the gridpoints W = zeros(length(x),length(y)); for i=1:length(x) for j=1:length(y) W(i,j) = 1/abs(Z(i,j)); end end % Plot W directly and scale the contour levels exponentially % The disadvantage is that the color scaling doesn't work well %[C,h] = contour(x,y, W, 10.^[-1:.1:2]); %caxis([10^-1 10^2]) % Plot log10(W) and scale the contour levels and color linearly % ('contourf' fills the space between contour lines with color, % 'contour' just plots colored contour lines.) [C,h] = contourf(x,y, log10(W), -1:.2:2); caxis([-1 2]) colorbar title('log10(1/|z|)') xlabel('Re z') ylabel('Im z') axis square axis equal axis tight </code> {{:unh2010:iam931:hw4:contoureg.png?400}} ==== exer 26.2 ==== eps-pseudospectra and ''||e^(tA)||'' versus t for 32 x 32 matrix A with -1 on main diagonal, alpha on 1st and 2nd superdiagonal, for a few values of alpha. Note that alpha = 1 gives the matrix asked for in exer 26.2, and alpha =0 gives a nice real symmetric matrix with eigenvalues -1 and orthogonal eigenvectors. alpha = 1.0 {{:unh2010:iam931:hw4:ex26_2a10.png?400}} {{:unh2010:iam931:hw4:ex26_2b10.png?400}} alpha = 0.7 {{:unh2010:iam931:hw4:ex26_2a7.png?400}} {{:unh2010:iam931:hw4:ex26_2b7.png?400}} alpha = 0.6 {{:unh2010:iam931:hw4:ex26_2a6.png?400}} {{:unh2010:iam931:hw4:ex26_2b6.png?400}} alpha = 0.5 {{:unh2010:iam931:hw4:ex26_2a5.png?400}} {{:unh2010:iam931:hw4:ex26_2b5.png?400}} alpha = 0.4 {{:unh2010:iam931:hw4:ex26_2a3.png?400}} {{:unh2010:iam931:hw4:ex26_2b3.png?400}}