Results 1 to 1 of 1

Math Help - Matlab diffusion limited aggregation

  1. #1
    Newbie
    Joined
    Dec 2009
    Posts
    1

    Matlab diffusion limited aggregation

    1. The problem statement, all variables and given/known data

    Hello, I have this project due for next Friday. I need help. Its on diffusion limited aggregation. A topic which is unfamiliar to me. I know exactly how to do the problem, but I don't know how to code it correctly. Basically I allow a seed particle to be in a location in a 9 x 9 matrix. Another particle is put into this matrix with a random location. basically just have to show that my code gives an image like the usual fractal images.



    2. Relevant equations

    None.



    3. The attempt at a solution

    Here's my code for the random walk;

    Code:
    ]
    % Daniel Lordan_108576939_ComputationalProject_MinimumGoal
    clear all % clears all variables
    
    xD = 0; % Holds vector of the previous values x has taken
    yD = 0; % Holds vector of the previous values y has taken
    rD = 0; % Used when calculating the  distance form origin
    x_position = 0; % Start position at origin
    y_position = 0; % Start position at origin
    
    num_steps = 2000;
    n = 9; 
    % Sets n equal to nine
    
    xx = round(rand(n));          
    % creates a 9 x 9 array of zeros or ones ie creates an array of random 
    % numbers between 0 and 1
    
    % this is just to generate some data for a 2-D "top-view" plot, 
    
    colormap([0 0 0;1 1 1]) 
    % creates a colormap of black and white
    
    imagesc(xx) 
    % plots the matrix xx as an image 
    
    axis square 
    % makes the plot square, as opposed to the usual rectangle 
    
    save(['E:\Matlab Project\matrix_xx.txt'], 'xx', '-ASCII','-TABS')
    % save the content of xx into a txt file
    
    perm_col = randperm(4); 
    % this generates a column vector containing a random permutation of the 
    % integers from 1 to 4 
    
    dir_mov = perm_col(1); 
    % the first element of perm_col will be a random number between 1 and 4 
    % and could be used to determine the direction of the next random walk step 
    
    for ctr = 1:(num_steps-1)
        direction = randperm(4); % Direction is chossen randomly from numers 1, 2, 3, 4
        if direction(1) == 1 
        x_position = x_position + 1; % Go East
        elseif direction(1) == 2
        x_position = x_position -1; % Go West
        elseif direction(1) == 3
        y_position = y_position + 1; % Go North
        elseif direction(1) == 4
        y_position = y_position -1; % Go South
        end
    
    end
    
    plot(xD, yD) 
    hold on
    Is that the correct coding for a random walk and how would I bring the actual dla into this problem. Thanks for anyone's help. It will be greatly appreciated as i'm freaking out and I know that I won't be able to do this.
    Last edited by CaptainBlack; December 13th 2009 at 11:02 PM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 1
    Last Post: December 7th 2010, 08:00 AM
  2. Replies: 3
    Last Post: July 23rd 2010, 04:19 PM
  3. Limited Sequence?
    Posted in the Calculus Forum
    Replies: 1
    Last Post: November 5th 2009, 07:28 AM
  4. area limited by the curve
    Posted in the Calculus Forum
    Replies: 6
    Last Post: January 25th 2009, 12:31 PM
  5. limited thoughts on limits :S
    Posted in the Pre-Calculus Forum
    Replies: 2
    Last Post: October 7th 2007, 08:06 AM

Search Tags


/mathhelpforum @mathhelpforum