1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Using theMatLab Monte Carlo method for volume of CN tower

  1. Sep 18, 2012 #1
    1. The problem statement, all variables and given/known data
    I have to do a monte carlo approximation for the Volume of the CN tower for my assignment
    but I don't know what size to make the cubes and for the part below the main pod I do not know how to create a tapered tower for loop that gets smaller with each loop so that the coordinates stay with in the triangle any help would be good this is what I have so far


    2. Relevant equations

    V=h*pi*(r)^2


    3. The attempt at a solution This the code my proff gave us(which has some of the dimension and he gave us the random coordinate generator plus the if statement for the pod, the rest is mine) to start plus my own modification I having trouble knowing if I did the monte carlo method correctly

    height =553.33;
    heightroof=457.2;
    tapoured_height=342;

    base_diameter=66.6;
    pod_baseh=200;
    pod_toph=250;
    n_trials=1e4;
    counter=0;
    Vpod=0;% volume pod
    Vtaop=0;%volume tapered tower
    vc=(1/n_trials)^3; %volume of cube
    base_tapered=66.6;
    coords=rand(n_trials,3);
    coords(:,3)=coords(:,3)*height;%scale z coordinates
    coords(:,1:2)=(coords(:,1:2)-.5)*pod_diametere;%scale z coordinates
    known_volume=height*(base_diametere^2)/4;
    %loop to check points
    for i=1:n_trials;
    %for pod
    if coords(i,3)>pod_baseh && coords(i,3)<pod_toph
    if sqrt(coords(i,1))^2 +(coords(i,2))^2<(pod_diameter/2)
    counter=counter+1;

    Vpod = Vpod+ sum(vc);
    end

    else
    %for tapered tower
    %%code to check if coords falls with in tapoured tower
    if coords(i,3)>0 && coords(i,3)<tapoured_height
    if sqrt(coords(i,1))^2 +(coords(i,2))^2<(base_tapered/2)
    base_tapered = ( base_tapered)/n_trials;

    Vtap = Vtap+ sum(vc);
    end

    end
    end
    end
    V=Vpod+Vtap; % volume total
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Using theMatLab Monte Carlo method for volume of CN tower
  1. Monte-Carlo Method (Replies: 2)

Loading...