# How can we define piecewise sinusoidal or triangular functions along a path on a hemisphere?

6 views (last 30 days)
Dave on 11 Feb 2014
Here are paths on the cylinder and hemisphere structure.
if true
clear all
N1=6; %determines number of segments on top
N2=10; %determines length as L=delta*N2
a=1; % diameter of top
aa=linspace(0, pi, N1);
z=a*sin(aa);
y=a*cos(aa);
delta=sqrt((y(2)-y(1))^2+(z(2)-z(1))^2); %Width of each segment
L=delta*N2; %height of cylinder
z=z+L;
z1=0:delta:L-delta;
z2=fliplr(z1);
z=[z1 z z2];
y1=ones(1,length(z1)).*y(1);
y2=ones(1,length(z2)).*y(end);
y=[y1 y y2];
x=zeros(1,length(z));
rho=sqrt(x.^2+y.^2);
L=delta*90; %whole length
N=length(y)
figure(1)
plot3(x,y,z,'*-r');
axis equal;
grid on
xlabel('x');ylabel('y');zlabel('z')
%Rotate
hold on
a=36
xRot = x.*cosd(a) - y.*sind(a);
yRot = x.*sind(a) + y.*cosd(a);
zRot=z;
plot3(xRot,yRot,zRot,'-k*');
end
Defining piecewise functions on the cylinder path is easy because its the function of z only. For example, on the red path, we can take f(z')=(sin((z(8)-z'))+sin((z'-z(7))))./sin(delta) to get a sine piece between 7th and 8th element and integrate it from 7th to 8th element of z. How can we define it on the hemisphere part of the path?
Thanks,
Dave