Thread Subject: plotting troubles

Subject: plotting troubles

From: makhoma Wood

Date: 23 Sep, 2009 02:18:02

Message: 1 of 2

I'm trying to take a 2D plot and rotate it about an axis to make it a 3D plot. I have used

plot(x,((BESSELJ(0,x)).^2).*((sin(pi*x)).^2),'c+-');

and am trying to rotate this about the x-axis so that is makes a 3D image of it. I have tried a 3D approach using

x = (BesselJ(0,(x.^2+y.^2).^(1/2))).^2.*(sin(pi*t)).^2;
y = (BesselJ(0,(x.^2+y.^2).^(1/2))).^2.*(sin(pi*t)).^2;
z = t;
plot3(x, y, z);

but this gives me a bunch of screwy lines that does not at all look like what I want/need. Any help/suggestions?


~Josh

Subject: plotting troubles

From: Jerome Briot

Date: 23 Sep, 2009 05:29:02

Message: 2 of 2

Hi,

try this :

%-------------
x = 0:.1:2;
y = (besselj(0,x).^2).*(sin(pi*x).^2);

th = linspace(0,2*pi,100);

yrev = cos(th(:))*y;
zrev = sin(th(:))*y;
xrev = repmat(x,numel(th),1);

figure
p=plot(x,y,'r-');
set(p,'linewidth',3)
hold on
surf(xrev,yrev,zrev)
grid on
axis equal vis3d
%-------------

Jerome

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
2d makhoma Wood 22 Sep, 2009 22:19:10
3d makhoma Wood 22 Sep, 2009 22:19:10
plot makhoma Wood 22 Sep, 2009 22:19:10
plot3 makhoma Wood 22 Sep, 2009 22:19:10
bessel makhoma Wood 22 Sep, 2009 22:19:10
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com