How to rotate a function about the y-axis

I wonder if anyone can help.
I have a Bessel function defined from x=0:20. I am trying to rotate it about the y-axis, so I can get a plot which resembles an Airy function.
I am struggling to write a for loop which will do this. Does anyone have a suggestion or pointers?
Thank you

댓글 수: 6

Wayne King
Wayne King 2011년 10월 5일
Hi Katy, please post the relevant MATLAB code so somebody can try to help you.
Jan
Jan 2011년 10월 5일
Do you want to plot dots or a surface? For the later you can take a look into the source of SPHERE: Rotating around the Y-Axis is like drawing a deformed hemisphere.
Katy Pointer
Katy Pointer 2011년 10월 5일
Hi Wayne; all I have at the moment is
x=[0.1:0.1:20];
J=besselj(1,x);
y=(J./x);
I don't even know how to get started trying to rotate it!
I want to end up with a matrix of values of height above the xy plane, so I can perform an fft on the result.
Thank you
Jan
Jan 2011년 10월 5일
At first you asked for a method to plot the values. Now you want the results as a matrix. This is a different job.
Katy Pointer
Katy Pointer 2011년 10월 5일
Isn't that the same thing? Then I can do mesh(matrix) to get the plot.
Jan
Jan 2011년 10월 5일
You can plot a matrix. But rotating the Bessel function leads to a circular shape, not to a rectangular matrix.

댓글을 달려면 로그인하십시오.

 채택된 답변

Teja Muppirala
Teja Muppirala 2011년 10월 5일

1 개 추천

Something like this maybe?
[X,Y]=meshgrid(-20:0.1:20);
R = sqrt(X.^2 + Y.^2);
J=besselj(1,R);
Z=(J./R);
Z(isnan(Z)) = 0.5; %Fix the divide by zero problem
surf(X,Y,Z);
shading flat;
camlight;

댓글 수: 1

Katy Pointer
Katy Pointer 2011년 10월 5일
That's amazing! Thank you. I had tried something similar, but didn't quite get the radius bit right. Thanks so much :)

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

카테고리

도움말 센터File Exchange에서 Bessel functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by