Pull up a chair!
Discussions is your place to get to know your peers, tackle the bigger challenges together, and have fun along the way.
- Want to see the latest updates? Follow the Highlights!
- Looking for techniques improve your MATLAB or Simulink skills? Tips & Tricks has you covered!
- Sharing the perfect math joke, pun, or meme? Look no further than Fun!
- Think there's a channel we need? Tell us more in Ideas
Trending Discussions
Hello, everyone! I’m Mark Hayworth, but you might know me better in the community as Image Analyst. I've been using MATLAB since 2006 (18 years). My background spans a rich career as a former senior scientist and inventor at The Procter & Gamble Company (HQ in Cincinnati). I hold both master’s & Ph.D. degrees in optical sciences from the College of Optical Sciences at the University of Arizona, specializing in imaging, image processing, and image analysis. I have 40+ years of military, academic, and industrial experience with image analysis programming and algorithm development. I have experience designing custom light booths and other imaging systems. I also work with color and monochrome imaging, video analysis, thermal, ultraviolet, hyperspectral, CT, MRI, radiography, profilometry, microscopy, NIR, and Raman spectroscopy, etc. on a huge variety of subjects.
I'm thrilled to participate in MATLAB Central's Ask Me Anything (AMA) session, a fantastic platform for knowledge sharing and community engagement. Following Adam Danz’s insightful AMA on staff contributors in the Answers forum, I’d like to discuss topics in the area of image analysis and processing. I invite you to ask me anything related to this field, whether you're seeking recommendations on tools, looking for tips and tricks, my background, or career development advice. Additionally, I'm more than willing to share insights from my experiences in the MATLAB Answers community, File Exchange, and my role as a member of the Community Advisory Board. If you have questions related to your specific images or your custom MATLAB code though, I'll invite you to ask those in the Answers forum. It's a more appropriate forum for those kinds of questions, plus you can get the benefit of other experts offering their solutions in addition to me.
For the coming weeks, I'll be here to engage with your questions and help shed light on any topics you're curious about.
cities
15%
beaches, islands, or cruises
22%
rivers, lakes, or mountains
33%
National Parks or historical sites
14%
wherever my family lives
12%
somewhere else
5%
12758 Stimmen
figure out what my old code does
18%
write code comments for future me
11%
address a code analyzer warning
3%
reflect on the skills I've gained
8%
get food on my mouse and keyboard
38%
All of the above
22%
15468 Stimmen
isstring
10%
ischar
7%
iscellstr
13%
isletter
21%
isspace
8%
ispunctuation
37%
1933 Stimmen
Don't use / What are Projects?
27%
1–10
31%
11–20
15%
21–30
8%
31–50
7%
51+ (comment below)
11%
2561 Stimmen
Gabriel's horn is a shape with the paradoxical property that it has infinite surface area, but a finite volume.
Gabriel’s horn is formed by taking the graph of
with the domain
and rotating it in three dimensions about the
axis.
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34101/image.png)
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34106/image.png)
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34111/image.png)
There is a standard formula for calculating the volume of this shape, for a general function
.Wwe will just state that the volume of the
solid between a and b is:
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34116/image.png)
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34121/image.png)
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34126/image.png)
The surface area of the solid is given by:
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34131/image.png)
One other thing we need to consider is that we are trying to find the value of these integrals between 1 and ∞. An integral with a limit of infinity is called an improper integral and we can't evaluate it simply by plugging the value infinity into the normal equation for a definite integral. Instead, we must first calculate the definite integral up to some finite limit b and then calculate the limit of the result as b tends to ∞:
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34136/image.png)
Volume
We can calculate the horn's volume using the volume integral above, so
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34141/image.png)
The total volume of this infinitely long trumpet isπ.
Surface Area
To determine the surface area, we first need the function’s derivative:
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34146/image.png)
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34151/image.png)
Now plug it into the surface area formula and we have:
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34156/image.png)
This is an improper integral and it's hard to evaluate, but since in our interval ![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34161/image.png)
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34161/image.png)
So, we have :
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34166/image.png)
Now,we evaluate this last integral
![](https://www.mathworks.com/matlabcentral/discussions/uploaded_files/34171/image.png)
So the surface are is infinite.
% Define the function for Gabriel's Horn
gabriels_horn = @(x) 1 ./ x;
% Create a range of x values
x = linspace(1, 40, 4000); % Increase the number of points for better accuracy
y = gabriels_horn(x);
% Create the meshgrid
theta = linspace(0, 2 * pi, 6000); % Increase theta points for a smoother surface
[X, T] = meshgrid(x, theta);
Y = gabriels_horn(X) .* cos(T);
Z = gabriels_horn(X) .* sin(T);
% Plot the surface of Gabriel's Horn
figure('Position', [200, 100, 1200, 900]);
surf(X, Y, Z, 'EdgeColor', 'none', 'FaceAlpha', 0.9);
hold on;
% Plot the central axis
plot3(x, zeros(size(x)), zeros(size(x)), 'r', 'LineWidth', 2);
% Set labels
xlabel('x');
ylabel('y');
zlabel('z');
% Adjust colormap and axis properties
colormap('gray');
shading interp; % Smooth shading
% Adjust the view
view(3);
axis tight;
grid on;
% Add formulas as text annotations
dim1 = [0.4 0.7 0.3 0.2];
annotation('textbox',dim1,'String',{'$$V = \pi \int_{1}^{a} \left( \frac{1}{x} \right)^2 dx = \pi \left( 1 - \frac{1}{a} \right)$$', ...
'', ... % Add an empty line for larger gap
'$$\lim_{a \to \infty} V = \lim_{a \to \infty} \pi \left( 1 - \frac{1}{a} \right) = \pi$$'}, ...
'Interpreter','latex','FontSize',12, 'EdgeColor','none', 'FitBoxToText', 'on');
dim2 = [0.4 0.5 0.3 0.2];
annotation('textbox',dim2,'String',{'$$A = 2\pi \int_{1}^{a} \frac{1}{x} \sqrt{1 + \left( -\frac{1}{x^2} \right)^2} dx > 2\pi \int_{1}^{a} \frac{dx}{x} = 2\pi \ln(a)$$', ...
'', ... % Add an empty line for larger gap
'$$\lim_{a \to \infty} A \geq \lim_{a \to \infty} 2\pi \ln(a) = \infty$$'}, ...
'Interpreter','latex','FontSize',12, 'EdgeColor','none', 'FitBoxToText', 'on');
% Add Gabriel's Horn label
dim3 = [0.3 0.9 0.3 0.1];
annotation('textbox',dim3,'String','Gabriel''s Horn', ...
'Interpreter','latex','FontSize',14, 'EdgeColor','none', 'HorizontalAlignment', 'center');
hold off
daspect([3.5 1 1]) % daspect([x y z])
view(-27, 15)
lightangle(-50,0)
lighting('gouraud')
The properties of this figure were first studied by Italian physicist and mathematician Evangelista Torricelli in the 17th century.
Acknowledgment
I would like to express my sincere gratitude to all those who have supported and inspired me throughout this project.
First and foremost, I would like to thank the mathematician and my esteemed colleague, Stavros Tsalapatis, for inspiring me with the fascinating subject of Gabriel's Horn.
I am also deeply thankful to Mr. @Star Strider for his invaluable assistance in completing the final code.
References:
I am trying to earn my Intro to MATLAB badge in Cody, but I cannot click the Roll the Dice! problem. It simply is not letting me click it, therefore I cannot earn my badge. Does anyone know who I should contact or what to do?
function ans = your_fcn_name(n)
n;
j=sum(1:n);
a=zeros(1,j);
for i=1:n
a(1,((sum(1:(i-1))+1)):(sum(1:(i-1))+i))=i.*ones(1,i);
end
disp
Check out the LLMs with MATLAB project on File Exchange to access Large Language Models from MATLAB.
Along with the latest support for GPT-4o mini, you can use LLMs with MATLAB to generate images, categorize data, and provide semantic analyis.