**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>