Effacer les filtres
Effacer les filtres

change this program from its symbolic structure to a new one?

2 vues (au cours des 30 derniers jours)
mohammad azsad
mohammad azsad le 6 Nov 2014
please help me this is program of Bspline plotter i want to change it .from line that u defined as symbolic i cant learned the program who can help me ?please help me?
clear,clc,format compact
number_of_points=5
p=[1 2 3;5 7 14;13 16 5;13 15 4;8 6 7];
P=p'
n = number_of_points - 1;
clc
k = 3
periodic = 2
while true
if periodic == 1
periodic = true;
break;
elseif periodic == 2
periodic = false;
break;
elseif periodic == 3
t = input('enter [t1,t2,...]: ');
break;
end
end
if periodic for ii = 0:n+k t(ii+1) = ii - k; end else for ii = 0:n+k; if ii >= 0 && ii < k t(ii+1) = 0; elseif ii >= k && ii <= n t(ii+1) = ii - k + 1; elseif ii > n && ii <= n+k t(ii+1) = n - k + 2; end end end knots = t' u_min = t(k-1 + 1); u_max = t(n+1 + 1); nos = length(t)-1; N{1} = eye(nos); satr = nos - 1; syms u; for m = 2:k N{m} = sym(zeros(satr,nos)) for mm = 1:satr surat = [u - t(mm) t(mm+m) - u]; makhraj = [t(mm+m-1)-t(mm) t(mm+m) - t(mm + 1)]; if makhraj(1) == 0 surat(1) = 0; makhraj(1) = 1; end if makhraj(2) == 0 surat(2) = 0; makhraj(2) = 1; end % N{m}(mm,mm) = for mmm = 1:nos N{m}(mm,mmm) = (surat./makhraj)*N{m-1}(mm:mm+1,mmm); end
N{m};
(surat./makhraj);
end
satr = satr - 1;
end
N{m};
rang = {'r','b','g','m','y','k','c','r','b','g','m','y','k','c','r','b','g','m','y','k','c','r','b','g','m','y','k','c','r','b','g','m','y','k','c','r','b','g','m','y','k','c'};
matr = P*N{m};
for m = 1:nos x = linspace(t(m),t(m+1),100); for mm = 1:3 javx{mm,m} = x; if matr(mm,m)== 0 jav{mm,m} = 0*x; else for mmm = 1:length(x) u = x(mmm); jav{mm,m}(mmm) = eval(matr(mm,m)); end end end plot3(jav{1,m},jav{2,m},jav{3,m},'color',rang{m},'linewidth',3) hold on end plot3(P(1,:),P(2,:),P(3,:),'or-') text(mean(P(1,:)),mean(P(2,:)),mean(P(3,:)),'rotate, it''s 3d','fontsize',13,'fontname','Segoe UI light') rotate3d on box

Réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by