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;
figure
[X,Y,Z] = cylinder(1/2*sin(25/68*x-2.3)+4.25,20);
surf(Z,X,Y)
xlabel('x'); ylabel('z'); zlabel('y')
hold on
[X,Y,Z] = cylinder(1/2*sin(25/68*x-2.3)+3.97,20);
surf(Z,X,Y)
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.

  0 Comments

Sign in to comment.

Answers (1)

darova
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);
surf(X,Y,Z)

  1 Comment

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

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!