How to link previous & next values to current values?

2 views (last 30 days)
D Dwiz
D Dwiz on 29 Mar 2017
Edited: D Dwiz on 29 Mar 2017
I've calculated values as follows for n=3 & k=3
% Degree
n = input('Degree of curve = ');
% Order
k = input('Order of curve = ');
% No. of control points
No_of_Control_point = n+1
% No_of_Knots
m = n+k+1
% Values_of knots as u_0, u_1, ...
for i = 0:(m - 1);
if i < k
u = 0
elseif (k <= i) && (i <= n)
u = i-k+1
else
u = n-k+2
end
end
% Finding N_i,k (u)...
Above coding gives 7 values of u as u=0,u=0,u=0,u=1,u=2,u=2 & u=2...& now I've to calculate a function [N_i,k(u)] for defined values for i = 0:5; (k = 3; it is constant) where if u_i<=u<=u_(i+1); N_i,k(u) = 1; else N_i,k(u) = 0 and so on... But I'm unable to understand that now to call u_i & u_(i+1) for calculating N_i,k(u). For good view see below...
% Finding N_i,k (u)...
% Here k = 1 ...
for i = 0:5;
if (u_i<=u) && (u<=u_(i+1)
N_i (u) = 1
else
N_i,k (u) = 0
end
end
% I'm unable to call u_i & u_(i+1)??
Can you help me please?

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!