From: striker on
Walter Roberson <roberson(a)hushmail.com> wrote in message <D2zHn.6914$V%2.6870(a)newsfe08.iad>...
> striker wrote:
>
> > this is the code for the normal cylinder on which I am working. I need a
> > curved cylinder with the same idea so that my calculation which are
> > based (working fine) on the normal cylinder also work on the curved
> > cylinder.
>
> Do you need the wall of the cylinder to be of constant thickness, or is
> it acceptable for it to vary in thickness (e.g., becoming thinner when
> the cylinder curves inward) ?
From: striker on
"striker " <friend_019(a)hotmail.com> wrote in message <hsmkrf$ceu$1(a)fred.mathworks.com>...
> Walter Roberson <roberson(a)hushmail.com> wrote in message <D2zHn.6914$V%2.6870(a)newsfe08.iad>...
> > striker wrote:
> >
> > > this is the code for the normal cylinder on which I am working. I need a
> > > curved cylinder with the same idea so that my calculation which are
> > > based (working fine) on the normal cylinder also work on the curved
> > > cylinder.
> >
> > Do you need the wall of the cylinder to be of constant thickness, or is
> > it acceptable for it to vary in thickness (e.g., becoming thinner when
> > the cylinder curves inward) ?

its okay in both cases
From: Walter Roberson on
striker wrote:
> % % Sample values
> h = 10;ri = 1;ra = 1;
> % % Create constant vectors
> tht = linspace(0,2*pi,100);
> z=linspace(-5,5,20);
>
> % % Create inner cylinder
> xi = repmat(ri*cos(tht),20,1);
> yi = repmat(ri*sin(tht),20,1);
> zi = repmat(z',1,100);
>
> % % Create outer cylinder
> xa = repmat(ra*cos(tht),20,1);
> ya = repmat(ra*sin(tht),20,1);
> za = zi;
>
> surf(xa,ya,za);axis image
> title('original 3D-object')
>
> % % Now, if you want to close the ends:
>
> x = [xi; flipud(xa); xi(1,:)];
> y = [yi; flipud(ya); yi(1,:)];
> z = [zi; flipud(za); zi(1,:)];
> figure
> surf(x,y,z)
>
> this is the code for the normal cylinder on which I am working. I need a
> curved cylinder with the same idea so that my calculation which are
> based (working fine) on the normal cylinder also work on the curved
> cylinder.

Change

> xi = repmat(ri*cos(tht),20,1);
> yi = repmat(ri*sin(tht),20,1);

to

zscale = F(z);
xi = zscale .' * (ri * cos(theta));
yi = zscale .' * (ri * sin(theta));

where F(z) is the function that scales the radius according to the z
value. For a cylinder that is thinner at the center, you would want F(z)
to be 1 for the ends and you would want F(z) to be least in the middle.
Fortunately, since z is symmetric around 0, a function that uses either
abs(z) or z to an even integer power would work.

For example,

minzscale = 0.8;
F = @(z) minzscale + (1-minzscale) .* (abs(z) ./ z(end));

The above will produce a linear sloping towards the center.

or

F = @(z) minzscale + (1-minzscale) .* (z.^2) ./ (z(end).^2);

The above produces a parabolic sloping towards the center.

or

F - @(z) minzscale + (1 - cos(z .* pi/2));

The above should produce a semi-circular arc shape.
From: striker on
Thanks for your help.It was very nice of you.kindly guide me that what are the equations for each of the functions that you have used.Thanks again
From: mat001 on
Walter Roberson <roberson(a)hushmail.com> wrote in message <PYIHn.6914$7d5.4164(a)newsfe17.iad>...
> striker wrote:
> > % % Sample values
> > h = 10;ri = 1;ra = 1;
> > % % Create constant vectors
> > tht = linspace(0,2*pi,100);
> > z=linspace(-5,5,20);
> >
> > % % Create inner cylinder
> > xi = repmat(ri*cos(tht),20,1);
> > yi = repmat(ri*sin(tht),20,1);
> > zi = repmat(z',1,100);
> >
> > % % Create outer cylinder
> > xa = repmat(ra*cos(tht),20,1);
> > ya = repmat(ra*sin(tht),20,1);
> > za = zi;
> >
> > surf(xa,ya,za);axis image
> > title('original 3D-object')
> >
> > % % Now, if you want to close the ends:
> >
> > x = [xi; flipud(xa); xi(1,:)];
> > y = [yi; flipud(ya); yi(1,:)];
> > z = [zi; flipud(za); zi(1,:)];
> > figure
> > surf(x,y,z)
> >
> > this is the code for the normal cylinder on which I am working. I need a
> > curved cylinder with the same idea so that my calculation which are
> > based (working fine) on the normal cylinder also work on the curved
> > cylinder.
>
> Change
>
> > xi = repmat(ri*cos(tht),20,1);
> > yi = repmat(ri*sin(tht),20,1);
>
> to
>
> zscale = F(z);
> xi = zscale .' * (ri * cos(theta));
> yi = zscale .' * (ri * sin(theta));
>
> where F(z) is the function that scales the radius according to the z
> value. For a cylinder that is thinner at the center, you would want F(z)
> to be 1 for the ends and you would want F(z) to be least in the middle.
> Fortunately, since z is symmetric around 0, a function that uses either
> abs(z) or z to an even integer power would work.
>
> For example,
>
> minzscale = 0.8;
> F = @(z) minzscale + (1-minzscale) .* (abs(z) ./ z(end));
>
> The above will produce a linear sloping towards the center.
>
> or
>
> F = @(z) minzscale + (1-minzscale) .* (z.^2) ./ (z(end).^2);
>
> The above produces a parabolic sloping towards the center.
>
> or
>
> F - @(z) minzscale + (1 - cos(z .* pi/2));
>
> The above should produce a semi-circular arc shape.

Dear Sir,

you seems to be very experienced with cylinder.

So i would like to discuss my problem also.

If I need cylinder with finite volume then how to start.