ENCHexam1

# ENCHexam1 - Acenter = cazerobc(Asub) noz =...

This preview shows pages 1–2. Sign up to view the full content.

Daniel Kish ENCH250 Exam 1 Life.m N = 3; A = round(rand(N,N)); M = 10; for m = 1:M imagesc(A); colormap gray pause(.1) for row = 2:N-1 for col = 2:N-1 Asub = A(row-1:col+1,row-1:col+1) Acenter = cazerobc(Asub) noz = nnz([A(row-1,col-1) A(row-1,col) A(row-1,col+1) ... A(row,col-1) A(row,col+1) ... A(row+1,col-1) A(row+1+1,col) A(row+1,col+1)]); switch noz case 0:1 Acenter = 0; case 2 Acenter = [row, col]; case 3 Acenter = 1; case 4:8 Acenter = 0; end end end A = Acopy; end Cazerobc.m N = 3; A = round(rand(N,N)); M = 10; for m = 1:M imagesc(A); colormap gray pause(.1) for row = 2:N-1 for col = 2:N-1 Asub = A(row-1:col+1,row-1:col+1)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Acenter = cazerobc(Asub) noz = nnz([A(row-1,col-1) A(row-1,col) A(row-1,col+1) ... A(row,col-1) A(row,col+1) ... A(row+1,col-1) A(row+1+1,col) A(row+1,col+1)]); switch noz case 0:1 Acenter = 0; case 2 Acenter = [row, col]; case 3 Acenter = 1; case 4:8 Acenter = 0; end end end A = Acopy; end Caperiodicbc.m function Acenter = caperiodicbc(X) Acenter = X; b = 1; m = 1:100 B=; for i=-b:b for j=-b:b B=[B,A(mod(x-1+i,m)+1,mod(y-1+j,m)+1)]; end end n=reshape(B,2*b+1,2*b+1)'; plot(n,m)...
View Full Document

## This note was uploaded on 04/28/2008 for the course ENCH 250 taught by Professor Adomaitis during the Spring '08 term at Maryland.

### Page1 / 2

ENCHexam1 - Acenter = cazerobc(Asub) noz =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online