zero domain changing to one in time

1 view (last 30 days)
shiva
shiva on 15 Oct 2014
Edited: Star Strider on 15 Oct 2014
Hello, The problem that I'm dealing with is a square domain that is zero everywhere in the begininng. then it startes to change to one as time passes. so I have selected the zero square matrix G that its elemetns chnages to one and how it switches to one depends on matrix A. actually my code uses the elements of matrix A. for instance, at the second time step the height from the center line that changes to one is the second element of matrixA and so on. if you take a look at my foor loops, you can understand the logic of how this change grows in the y direction from the centerline. the important point here is that the A matrix elemetn are not integers. I was wondering whether there is any other way of chosing the domain. this approach is not precise since I'm using a matrix and it rounds all the elements to the nearest integer number. I hope i have not been confusing and I appreciate all your valuable suggestions in advance.
clear all;
m=1000;
n=1000;
G=zeros(m,n);
G(500,1)=1;
A(1,1)=1;
for i=2:1:1000
sol=roots([1 -A(i-1,1) -1]);
A(i,1)=sol(sol>=0);
end
for t=1:1:1000
G(500,t)=1;
for i=1:1:t
for j=1:1:A(t-i+1)
G(500+j,i)=1;
G(500-j,i)=1;
end
end
end
colormap('hot')
imagesc(G(:,(1:1000)))
colorbar

Answers (0)

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!