2.0

2.0 | 4 ratings Rate this file 16 Downloads (last 30 days) File Size: 404.42 KB File ID: #8490
image thumbnail

3D Plot on a Cylindrical Surface

by J De Freitas

 

16 Sep 2005 (Updated 23 Sep 2005)

CYL3D plots 3D data on a cylinder.

| Watch this File

File Information
Description

CYL3D(Zin,theta_min,theta_max,Rho,H,meshscale) plots the 3D profile Zin as a mesh plot on a cylindrical surface of radius Rho, with mesh size determined by meshscale, for equally spaced
angles between theta_min and theta_max. H is the cylinder height.
 
CYL3D(Zin,...,meshscale,plotspec) plots the 3D profile Zin with a plot type specification. If plotspec = 'surf' a standard MATLAB
surface is plotted, whereas 'mesh', 'surfc' or 'meshc' will plot mesh, surface with countour, or mesh with contour, respectively.

CYL3D(Zin,...,meshscale,interpspec) plots the 3D profile Zin with the interpolation specification, interpspec, which can be one of 'spline', 'linear', 'nearest' or 'cubic'. The default interpolation is linear if not specified.

CYL3D(Zin,...,meshscale,Zscale) plots the 3D profile Zin with the data scaling factor, Zscale. This allows you to scale the peaks and troughs of the data on the surface if the radius is
relatively large. Zscale larger than 1 magnifies the data range correspondingly. Zscale defaults to 1 if not specified.

[Xout,Yout,Zout,Cmap] = CYL3D(Zin,...) returns output values corresponding to the Cartesian positions (Xout,Yout,Zout) with colour mapping, Cmap.

This function was developed under Ver. 7 R14SP1 and has been updated to be compatible with earlier Matlab versions, however there is no guarantee of compatibility.

If you do have any problems using the function please contact the author.

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
18 Sep 2005 John Hazel

Absolutely useless. Producess errors even in examples:
>> P = peaks(20);
cyl3d(P,-pi/2,pi,20,20,.4,'spline',1.5);
??? Error using ==> mtimes
Inner matrix dimensions must agree.

Error in ==> pol2cart at 12
RCST = r*cos(theta*rho);

Error in ==> cyl3d at 464
    [Xout(j,:) Yout(j,:) Zout(j,:)] = pol2cart(theta(j,:),Rho+Zscale*T(j,:),Z(j,:));

20 Sep 2005 J De Freitas

John,
I'm disappointed it didn't work for you and I fully understand your frustration. It would be useful though if you could send me details of the Matlab Release you use and together we can do some detective work to sort out your problems. Cheers.

12 Oct 2005 Cristian Nastase  
12 Oct 2005 Cristian Nastase

Very good. It has minor problems with Matlab 6.5. Took me 5 mins to correct it. All the examples work now. Most probably because v7.0 is more tolerant. Please find attached the PATCH. Question: How can I change it to do the same on a arbitrary inclined plane (or arbitrary surface in 3D).
--- diff
517c517
< h=colorbar; set(h,'YTickLabel',stepLabel);
---
> colorbar('YTickLabel',stepLabel);
571,572c571,572
< x(1:num,nLevel) = C(1,2:num+1)';
< y(1:num,nLevel) = C(2,2:num+1)';
---
> x(1:num,nLevel) = C(1,2:num+1);
> y(1:num,nLevel) = C(2,2:num+1);

04 May 2008 akbar sohoulipour

thankyou

17 Jul 2010 Bouziane Yebka  
Please login to add a comment or rating.
Updates
23 Sep 2005

Version 1.1 should now be compatible with earlier Matlab versions.

Tag Activity for this File
Tag Applied By Date/Time
specialized J De Freitas 22 Oct 2008 08:00:08
plotting J De Freitas 22 Oct 2008 08:00:08
3d plot J De Freitas 22 Oct 2008 08:00:08
cylinder J De Freitas 22 Oct 2008 08:00:08
cyl3d J De Freitas 22 Oct 2008 08:00:08
graphics J De Freitas 22 Oct 2008 08:00:08
cylindrical surface J De Freitas 22 Oct 2008 08:00:08
3d plot Sadam 20 Jan 2012 09:32:20
cylindrical surface Rafael 21 Feb 2012 17:40:39
3dplot Lucia Rábago 18 Apr 2012 21:39:45

Contact us at files@mathworks.com