function s = e11v2(m) % s = e11v2(m): return a $m$-by-$2m$ string matrix $s$ with % + $*$s on the border (left, right, top, and bottom edges) % + $\$s on the diagonal, except for on the border % (the *diagonal* of a matrix = all valid positions (i,i) in the matrix) % + $-$s below the diagonal, except for on the border % + $+$s on the boundary, $@$s in the interior, and $c$ at the center of % a disk of radius $round(m*.35)$ and center $(round(m*1.5),round(m/2))$ % version where $x$s are generated from $y$s n = 2*m; % width of $s$ % [3/14] fixed typo below, where $xc<-->yc$ xc = round(m*1.5); yc = round(m/2); % (yc,xc) = center of disk r = round(m*.35); % radius of disk % note: deleted definition of coordinate matrices $x$,$y$ from skeleton code s(m,n) = ' '; % make $s$ large enough s(:,:) = 'o'; % fill each element with $'o'$ % place $-$s below diagonal: x < y for y = 1:m for x = 1:y-1; s(y,x) = '-'; end end % place $\$s on diagonal: x = y for y = 1:m x = y; s(y,x) = '\'; end % place $*$s on border: y = 1, y = m, x = 1, x = n % top edge y = 1; for x = 0*y + (1:n) % or just $1:n$ s(y,x) = '*'; end % bottom edge y = m; for x = 0*y + (1:n) % or just $1:n$ s(y,x) = '*'; end % left and right edges for y = 1:m % left edge x = 0*y + 1; % or just $1$ s(y,x) = '*'; % right edge x = 0*y + n; % or just $n$ s(y,x) = '*'; end warning('disk not done using this approach')