How can I make a B spline with specific values of 1st derivative at breakpoints (not only ends) using MATLAB?

163 Views Asked by At

I used csape function in curve fitting toolbox, it enables the user of choosing derivative values at the both ends.

Is there a way to control the value of the derivative a specific breakpoint?

I want to set one of the values of the derivatives to be zero at one breakpoint, to make it a maximum.

Here is the code:

%% Times
k=0;
Tc = 1; %step time in second
Td = .15*Tc; %the DSP time
t0=k*Tc;
t1=t0+Td;
t2=t0+Tc;
t3=t2+Td;
Tm=.5*Tc; 
tmaxh=t0+Tm;

%% Z Height
hgs=0;
hge=0;
Hao=.12;
Lan=.079;
Laf=.2;
Lab=.05;
Ds=.6;
Lao=.6667*Ds; 
qb=10;
qf=10;

%% Spline generation using cublic spline.
tt=[t0 t1 tmaxh t2 t3];
zz=[hgs+Lan hgs+Laf*sind(qb)+Lan*cosd(qb) Hao hge+Lab*sind(qf)+Lan*cosd(qf) hge+Lan];
cs = csape(tt,zz,[1 0 0 0 1],[0 0 0 0 0])
figure
fnplt(cs)

After the comment %% Spline generation using cubic spline. I have two vectors one for time and one for another value that changes with time and I want to make b-spline of 3rd order.

I used csape because it enables the user to determine the value of the derivatives at end points.cs = csape(tt,zz,[1 0 0 0 1],[0 0 0 0 0]) the ones are to tell the tool to make the 1st derivative at the end points = 0.

I want the point that occurs at time = tmaxh to be the maximum point on the spline.

I tried making this by placing 1 in the [1 0 0 0 1] so it become [1 0 1 0 1] as I know that the 1st derivative at a maximum is 0, but this method didn't work for me.

Thank you.

0

There are 0 best solutions below