MATLAB Answers

Delimitation of cylinder function

1 view (last 30 days)
Alejandro Castro
Alejandro Castro on 9 Mar 2020
I'm trying to do the revolution solid of a seccionated function as the following
And im using the following script
clc, clear all, close all
x = 1.983:0.1:10;
[X,Y,Z] = cylinder(1/2*sin(25/68*x-2.3)+4.25,20);
xlabel('x'); ylabel('z'); zlabel('y')
hold on
[X,Y,Z] = cylinder(1/2*sin(25/68*x-2.3)+3.97,20);
The problem is that it appears that the cylinder function restricts the vectors to the scope of 0 to 1. And i'm trying that the sine functions appears from 1.9 to 10 and it appears from 0 to 1. This is the result that I get.


Sign in to comment.

Answers (1)

darova on 9 Mar 2020
You can build the surface manually (without using cylinder)
x = 1.983:0.1:10;
r = 1/2*sin(25/68*x-2.3)+4.25;
t = linspace(0,2*pi,20);
[T,X] = meshgrid(t,x);
[~,R] = meshgrid(t,r);
[Y,Z] = pol2cart(T,R);

  1 Comment

Alejandro Castro
Alejandro Castro on 9 Mar 2020
Thanks it helped a lot. I appreciate it

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!