Info

This question is closed. Reopen it to edit or answer.

How to correct the error involving function ?

1 view (last 30 days)
sheeha666
sheeha666 on 10 May 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
I try to run the matlab code from internet about B-spline.But t does not work and the error " not enough input arguments " appear. I don't really understand how the function in matlab works. This is the matlab code.
function spline(n,order)
% function spline(n,order)
%
% Plots the B-slpine-curve of n control-points.
% The control points can be chosen by clicking
% with the mouse on the figure.
%
% COMMAND: spline(n,order)
% INPUT: n Number of Control-Points
% order Order ob B-Splines
% Argnument is arbitrary
% default: order = 4
%
% Date: 2007-11-28
% Author: Stefan Hüeber
close all;
if (nargin ~= 2)
order = 4;
end
nplot = 100;
if (n < order)
display([' !!! Error: Choose n >= order=',num2str(order),' !!!']);
return;
end
figure(1);
hold on; box on;
set(gca,'Fontsize',16);
t = linspace(0,1,nplot);
for i = 1:n
title(['Choose ',num2str(i),' th. control point']);
p(i,:) = ginput(1);
hold off;
plot(p(:,1),p(:,2),'k-','LineWidth',2);
axis([0 1 0 1]);
hold on; box on;
if (i >= order)
T = linspace(0,1,i-order+2);
y = linspace(0,1,1000);
p_spl = DEBOOR(T,p,y,order);
plot(p_spl(:,1),p_spl(:,2),'b-','LineWidth',4);
end
plot(p(:,1),p(:,2),'ro','MarkerSize',10,'MarkerFaceColor','r');
end
title(['B-Spline-curve with ',num2str(n),' control points of order ',num2str(order)]);
How to solve this problem ? Is there any mistake that I should change ? This is not my coding. I copied it from internet to see how it works. But it doesn't work.
  1 Comment
Walter Roberson
Walter Roberson on 10 May 2015
Which line does it complain that there are not enough input arguments?
How are you executing the routine? What parameters are you passing to it?

Answers (0)

Community Treasure Hunt

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

Start Hunting!