Using theMatLab Monte Carlo method for volume of CN tower

In summary, it seems like you have a good start on your Monte Carlo approximation for the volume of the CN tower, but there are some areas that could be improved upon for better accuracy and efficiency.
  • #1
Eng_physicist
30
0

Homework Statement


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


Homework Equations



V=h*pi*(r)^2

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
 
Physics news on Phys.org
  • #2

approx_volume=V*known_volume; %monte carlo approximation


Hello there,

It looks like you have a good start on your Monte Carlo approximation for the volume of the CN tower. Your code seems to be following the correct steps and using the appropriate equations. However, there are a few things that could be improved upon to make your code more accurate and efficient.

Firstly, for the tapered tower, instead of creating a loop to check if each coordinate falls within the tower, you can use a mathematical equation to define the shape of the tower and then check if each coordinate falls within that equation. This will make your code more efficient and accurate.

Secondly, for the cubes, it would be best to make them smaller than the diameter of the base of the tower. This will allow for a more accurate approximation of the volume.

Lastly, instead of using a fixed number of trials (n_trials), it would be better to use a variable that can be adjusted for different levels of accuracy. This way, you can run your code multiple times with different values of n_trials to see how it affects the accuracy of your approximation.

I hope this helps and good luck with your assignment!
 

Related to Using theMatLab Monte Carlo method for volume of CN tower

1. How does the MatLab Monte Carlo method work for calculating the volume of the CN Tower?

The MatLab Monte Carlo method uses random sampling to estimate the volume of a complex shape, such as the CN Tower. It starts by creating a large number of random points within a bounding box that encloses the shape. Then, it determines which points fall within the shape and calculates the ratio of points inside the shape to the total number of points. This ratio is then multiplied by the volume of the bounding box to estimate the volume of the shape.

2. What are the advantages of using the MatLab Monte Carlo method for calculating the volume of the CN Tower?

The MatLab Monte Carlo method is advantageous because it can be applied to complex shapes that may not have a known mathematical formula for calculating their volume. It is also a relatively simple and efficient method compared to other numerical integration techniques. Additionally, it can provide a more accurate estimation of volume compared to traditional methods when dealing with irregular or non-uniform shapes.

3. How accurate is the MatLab Monte Carlo method for calculating the volume of the CN Tower?

The accuracy of the MatLab Monte Carlo method depends on the number of random points used in the calculation. Generally, the more points that are used, the more accurate the estimation will be. However, it is important to note that the method is still an estimation and may not provide an exact value for the volume.

4. Are there any limitations to using the MatLab Monte Carlo method for calculating the volume of the CN Tower?

One limitation of the MatLab Monte Carlo method is that it can be computationally intensive, especially when dealing with complex shapes. This means that it may take longer to obtain a more accurate estimation of the volume. Additionally, the method may not be suitable for shapes with concave surfaces or holes.

5. Can the MatLab Monte Carlo method be used for other shapes besides the CN Tower?

Yes, the MatLab Monte Carlo method can be used for any complex shape that may not have a known mathematical formula for calculating its volume. It is a versatile method that can be applied to a wide range of shapes in various fields, such as engineering, physics, and computer graphics.

Similar threads

  • Programming and Computer Science
Replies
1
Views
792
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
12
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
2K
  • Atomic and Condensed Matter
Replies
3
Views
944
Replies
0
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
934
  • Programming and Computer Science
Replies
3
Views
1K
Back
Top