12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

40 Answers to Exercises(Part II, <strong>Beyond</strong> the <strong>Basics</strong>)Exercise 7 (Page 74)To repeat the calculation for the case <strong>of</strong> 100 nodes, we do the following:dt = 2*pi/100;t = dt:dt:100*dt;x = cos(t)’;y = sin(t)’;xy = [x y];e = ones(100,1);A = spdiags(e,2 ,100,100) + ...spdiags(e,50,100,100) + ...spdiags(e,98,100,100);A = A +A’;subplot(221)spy(A)subplot(222)gplot(A,xy)axis equal <strong>of</strong>fThe next part <strong>of</strong> the exercise is to change the connection matrix. Aninteresting one is the geometrically parallel network:A = spdiags(e, 25,100,100) + ...spdiags(e,-75,100,100);A = fliplr(A);subplot(221)spy(A)subplot(222)gplot(A,xy)axis equal <strong>of</strong>fExercise 8 (Page 75)This will produce a list <strong>of</strong> the ascii characters corresponding to theintegers from zero to 255:I = (0:255)’;[int2str(I) blanks(256)’ char(I)]Some <strong>of</strong> the output is shown below:c○ 2000 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!