圆柱体上的样条

时间:2016-02-02 01:22:40

标签: matlab plot spline

我试图根据T型接头的几何形状在matlab上绘制下图中的蓝线。我使用坐标迭代和样条函数来执行此操作。我不知道为什么,但我不能让它正常工作。你能点燃我吗?

谢谢,

全部清除;     CLC;

%Defining Graph size
x = -D/2:((D/2)+l2);
y = -l1/2 :l1/2;
z = -D/2: D/2;

%Variable Definition
r = D/2;


%Winding step one

for y=-r-l2:0.01:0;
    x = -(r+l2)/r;
    z = sqrt(r.^2-x.^2);
    xyz = [x ; y ; z];
    %can be erased to remove points
    fnplt(cscvn(xyz(:,[1:end 1])),'r',2);
    hold on;
    end

    %Axis Labeling
xlabel('X Axis','FontSize',14);
ylabel('Y Axis','FontSize',14);
zlabel('Z Axis','FontSize',14);
title('Tjoint winding w/o radii','FontSize',14);

1 个答案:

答案 0 :(得分:0)

我在一个良好的睡眠之后自己发现了我的错误,这很明显我只是对我使用的等式做了一个错误。这里是经过纠正的代码,如果它对某人有用。

  clear all;
clc;
%TJoint Winding w/o radius
%The idea is to experiment with matlab 

%Obtains the values 
D = 'What is the diameter of the t joint? ';
D = input(D);

l1 = 'What is the length 1 of the t joint? ';
l1 = input(l1);

l2 = 'What is the length 2 of the t joint? ';
l2 = input(l2);

w = 'What is the width of the carbon fiber used? ';
w = input(w);

'Thank you, we are now processing the Filament winding of your T-Joint. Please wait ';

%Defining Graph size
x = -l1/2 :l1/2;
y = -D/2:((D/2)+l2);
z = -D/2: D/2;

%Variable Definition
r = D/2;


%Winding step one

for y=-r-l2:0.01:0;
    x = (-r/(r+l2))*y ;
    z = sqrt(r.^2-x.^2);
    xyz = [x ; y ; z];
    %can be erased to remove points
    fnplt(cscvn(xyz(:,[1:end 1])),'r',2);
    hold on;
    end

    %Axis Labeling
xlabel('X Axis','FontSize',14);
ylabel('Y Axis','FontSize',14);
zlabel('Z Axis','FontSize',14);
title('Tjoint winding w/o radii','FontSize',14);