フィルターのクリア

Why this code does Not work?

2 ビュー (過去 30 日間)
STamer
STamer 2013 年 6 月 26 日
function [B, id] = nrbbasisfun (points, nrb)
% NRBBASISFUN: Basis functions for NURBS % % Calling Sequence: % % B = nrbbasisfun (u, crv) % B = nrbbasisfun ({u, v}, srf) % [B, N] = nrbbasisfun ({u, v}, srf) % [B, N] = nrbbasisfun (p, srf) % % INPUT: % % u or p(1,:,:) - parametric points along u direction % v or p(2,:,:) - parametric points along v direction % crv - NURBS curve % srf - NURBS surface % % OUTPUT: % % B - Value of the basis functions at the points % size(B)=[numel(u),(p+1)] for curves % or [numel(u)*numel(v), (p+1)*(q+1)] for surfaces % % N - Indices of the basis functions that are nonvanishing at each % point. size(N) == size(B) % % % Copyright (C) 2009 Carlo de Falco % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version.
% This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see http://www.gnu.org/licenses/.
if ( (nargin<2) ...
|| (nargout>2) ...
|| (~isstruct(nrb)) ...
|| (iscell(points) && ~iscell(nrb.knots)) ...
|| (~iscell(points) && iscell(nrb.knots) && (size(points,1)~=2)) ...
|| (~iscell(nrb.knots) && (nargout>1)) ...
)
error('Incorrect input arguments in nrbbasisfun');
end
if (~iscell(nrb.knots)) %%NURBS curve
[B, id] = nrb_crv_basisfun__ (points, nrb);
elseif size(nrb.knots,2) == 2 %%NURBS surface
if (iscell(points))
[v, u] = meshgrid(points{2}, points{1});
p = [u(:), v(:)]';
else
p = points;
end
[B, id] = nrb_srf_basisfun__ (p, nrb);
else %%NURBS volume
error('The function nrbbasisfun is not yet ready for volumes')
end
end
%!demo %! U = [0 0 0 0 1 1 1 1]; %! x = [0 1/3 2/3 1] ; %! y = [0 0 0 0]; %! w = [1 1 1 1]; %! nrb = nrbmak ([x;y;y;w], U); %! u = linspace(0, 1, 30); %! B = nrbbasisfun (u, nrb); %! xplot = sum(bsxfun(@(x,y) x.*y, B, x),2); %! plot(xplot, B) %! title('Cubic Bernstein polynomials') %! hold off
Is there anyone can help me? I'm trying to do the demo above and I'm having eror message. Please help.
  4 件のコメント
STamer
STamer 2013 年 6 月 26 日
Line 56 ---> [B, id] = nrb_crv_basisfun__ (points, nrb);
Jan
Jan 2013 年 6 月 26 日
Please format your code properly, when you want others to encourage to read it.

サインインしてコメントする。

採用された回答

Jan
Jan 2013 年 6 月 26 日
The error message means, that the function nrb_crv_basisfun__ is not found. Did you installed it and if so, has the corresponding folder been added to the path?
  1 件のコメント
STamer
STamer 2013 年 6 月 26 日
Ok. Thank you. I'm so tired.Sorry for that easy question :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSplines についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by