# Advanced Mathematics and Mechanics Applications Using MATLAB, 3rd Edition

### Howard Wilson (view profile)

14 Oct 2002 (Updated )

Companion Software (amamhlib)

cylfigs
```function cylfigs
% cylfigs
% ~~~~~~~
% This function plots the geometries
% pertaining to four data cases used
% to test closest proximity problems
% involving two circular cylinders
%
% User m functions called: plot2cyls

d=.4; subplot(2,2,1)
R0,V,d,'CASE 1'); hold on
plot3(w(p,1),w(p,2),w(p,3),'linewidth',2,'color','k')
hold off

d=.4; subplot(2,2,2);
R0,V,d,'CASE 2'); hold on
plot3(w(q,1),w(q,2),w(q,3),'linewidth',2,'color','k')
hold off

d=.4; subplot(2,2,3)
R0,V,d,'CASE 3'); hold on
plot3(w(s,1),w(s,2),w(s,3),'linewidth',2,'color','k')
hold off

d=.4; subplot(2,2,4);
R0,V,d,'CASE 4'); hold on
plot3(w(t,1),w(t,2),w(t,3),'linewidth',2,'color','k')
hold off, subplot
print -deps cylclose

%==============================================

function [x,y,z,X,Y,Z]=plot2cyls(...
%                         Len,R0,Vc,d,titl)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% This function generates point grids on the
% surfaces of two circular cylinders and plots
% both cylinders together
%
% User m functions called: cornrpts surfmany
%                          cylpts
if nargin==0
titl='TWO CYLINDERS';
end
if isempty(titl), titl=' '; end
nu=ceil(u/d); nv=ceil(v/d);
v=linspace(0,1,nv);