|
|
|
|
%% Skript zum Plot Basisfunktionen
|
|
|
|
|
|
|
|
|
|
%Skript f<EFBFBD>r Plotbasics
|
|
|
|
|
basics_plot
|
|
|
|
|
figure
|
|
|
|
|
clf
|
|
|
|
|
% hold on
|
|
|
|
|
% box on
|
|
|
|
|
% grid on
|
|
|
|
|
|
|
|
|
|
U_Knot = [0,0,0,1,2,2,3,4,5,5,5];
|
|
|
|
|
p = 2;
|
|
|
|
|
|
|
|
|
|
uidx = [min(U_Knot):0.01:max(U_Knot)];
|
|
|
|
|
|
|
|
|
|
Ni2 = zeros(numel(uidx),numel(U_Knot)-1-2);
|
|
|
|
|
Ni1 = zeros(numel(uidx),numel(U_Knot)-1-2);
|
|
|
|
|
Ni0 = zeros(numel(uidx),numel(U_Knot)-1-2);
|
|
|
|
|
|
|
|
|
|
for i = 1:numel(uidx)
|
|
|
|
|
s = findspan(length(U_Knot)-p-2, p, uidx(i), U_Knot);
|
|
|
|
|
if s>4
|
|
|
|
|
stop = 1;
|
|
|
|
|
end
|
|
|
|
|
ndu = Allbasisfun(s,uidx(i),p,U_Knot);
|
|
|
|
|
Ni2(i,s-(p+1)+1:s) = ndu(:,end)';
|
|
|
|
|
Ni1(i,s-(p+1)+1:s-1) = ndu(1:2,end-1)';
|
|
|
|
|
Ni0(i,s-(p+1)+1:s-2) = ndu(1,end-2)';
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Ni2(Ni2==0)=nan;
|
|
|
|
|
Ni1(Ni1==0)=nan;
|
|
|
|
|
Ni0(Ni0==0)=nan;
|
|
|
|
|
|
|
|
|
|
f2 = figure;
|
|
|
|
|
hold on
|
|
|
|
|
box on
|
|
|
|
|
grid on
|
|
|
|
|
for i = 1:size(Ni2,2)
|
|
|
|
|
boolSwitch = false;
|
|
|
|
|
switch i
|
|
|
|
|
case 1
|
|
|
|
|
line=myLineOne;
|
|
|
|
|
if max(Ni2(:,i))>0
|
|
|
|
|
text(uidx(25)-0.15,Ni2(25,i)+0.2,strcat('$\N{',num2str(i-1),'}{',num2str(p-0),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 2
|
|
|
|
|
line=myLineTwo;
|
|
|
|
|
if max(Ni2(:,i))>0
|
|
|
|
|
text(uidx(75)-0.25,Ni2(75,i)+0.08,strcat('$\N{',num2str(i-1),'}{',num2str(p-0),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 3
|
|
|
|
|
line=myLineThree;
|
|
|
|
|
if max(Ni2(:,i))>0
|
|
|
|
|
text(uidx(125)-0.2,Ni2(125,i)+0.08,strcat('$\N{',num2str(i-1),'}{',num2str(p-0),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 4
|
|
|
|
|
line=myLineFour;
|
|
|
|
|
if max(Ni2(:,i))>0
|
|
|
|
|
text(uidx(175)-0.15,Ni2(225,i)+0.25,strcat('$\N{',num2str(i-1),'}{',num2str(p-0),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 5
|
|
|
|
|
line=myLineFive;
|
|
|
|
|
if max(Ni2(:,i))>0
|
|
|
|
|
text(uidx(225)+0.11,Ni2(225,i)+0.35,strcat('$\N{',num2str(i-1),'}{',num2str(p-0),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 6
|
|
|
|
|
line=myLineSix;
|
|
|
|
|
if max(Ni2(:,i))>0
|
|
|
|
|
text(uidx(350)-0.25,Ni2(350,i)+0.07,strcat('$\N{',num2str(i-1),'}{',num2str(p-0),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 7
|
|
|
|
|
line=myLineSeven;
|
|
|
|
|
if max(Ni2(:,i))>0
|
|
|
|
|
text(uidx(410)-0.1,Ni2(410,i)+0.15,strcat('$\N{',num2str(i-1),'}{',num2str(p-0),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 8
|
|
|
|
|
line=myLineOne;
|
|
|
|
|
if max(Ni2(:,i))>0
|
|
|
|
|
text(uidx(470)-0.14,Ni2(470,i)+0.3,strcat('$\N{',num2str(i-1),'}{',num2str(p-0),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
%Punkte generieren:
|
|
|
|
|
if boolSwitch
|
|
|
|
|
plot(uidx,Ni2(:,i),'LineStyle','-','Color',line)
|
|
|
|
|
axeshandle = findall(f2, 'type', 'axes');
|
|
|
|
|
set(axeshandle,'YLim',[0,1.1]);
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
f1 = figure;
|
|
|
|
|
hold on
|
|
|
|
|
box on
|
|
|
|
|
grid on
|
|
|
|
|
for i = 1:size(Ni1,2)
|
|
|
|
|
boolSwitch = false;
|
|
|
|
|
switch i
|
|
|
|
|
case 1
|
|
|
|
|
line=myLineOne;
|
|
|
|
|
if max(Ni1(:,i))>0
|
|
|
|
|
text(uidx(25)-0.02,Ni1(25,i)+0.05,strcat('$\N{',num2str(i-1),'}{',num2str(p-1),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 2
|
|
|
|
|
line=myLineTwo;
|
|
|
|
|
if max(Ni1(:,i))>0
|
|
|
|
|
text(uidx(75),Ni1(75,i),strcat('$\N{',num2str(i-1),'}{',num2str(p-1),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 3
|
|
|
|
|
line=myLineThree;
|
|
|
|
|
if max(Ni1(:,i))>0
|
|
|
|
|
text(uidx(175)-0.23,Ni1(175,i)+0.08,strcat('$\N{',num2str(i-1),'}{',num2str(p-1),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 4
|
|
|
|
|
line=myLineFour;
|
|
|
|
|
if max(Ni1(:,i))>0
|
|
|
|
|
text(uidx(225),Ni1(225,i)+0.05,strcat('$\N{',num2str(i-1),'}{',num2str(p-1),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 5
|
|
|
|
|
line=myLineFive;
|
|
|
|
|
if max(Ni1(:,i))>0
|
|
|
|
|
text(uidx(275),Ni1(275,i),strcat('$\N{',num2str(i-1),'}{',num2str(p-1),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 6
|
|
|
|
|
line=myLineSix;
|
|
|
|
|
if max(Ni1(:,i))>0
|
|
|
|
|
text(uidx(375)-0.25,Ni1(375,i)+0.07,strcat('$\N{',num2str(i-1),'}{',num2str(p-1),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 7
|
|
|
|
|
line=myLineSeven;
|
|
|
|
|
if max(Ni1(:,i))>0
|
|
|
|
|
text(uidx(475)-0.25,Ni1(475,i)+0.07,strcat('$\N{',num2str(i-1),'}{',num2str(p-1),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 8
|
|
|
|
|
line=myLineOne;
|
|
|
|
|
if max(Ni1(:,i))>0
|
|
|
|
|
text(uidx(470)-0.14,Ni1(470,i)+0.3,strcat('$\N{',num2str(i-1),'}{',num2str(p-1),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
%Punkte generieren:
|
|
|
|
|
if boolSwitch
|
|
|
|
|
plot(uidx,Ni1(:,i),'LineStyle','-','Color',line)
|
|
|
|
|
axeshandle = findall(f1, 'type', 'axes');
|
|
|
|
|
set(axeshandle,'YLim',[0,1.1]);
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
f0 = figure;
|
|
|
|
|
hold on
|
|
|
|
|
box on
|
|
|
|
|
grid on
|
|
|
|
|
for i = 1:size(Ni0,2)
|
|
|
|
|
boolSwitch = false;
|
|
|
|
|
switch i
|
|
|
|
|
case 1
|
|
|
|
|
line=myLineOne;
|
|
|
|
|
if max(Ni0(:,i))>0
|
|
|
|
|
text(uidx(20),0.9,strcat('$\N{',num2str(i-1),'}{',num2str(p-2),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 2
|
|
|
|
|
line=myLineTwo;
|
|
|
|
|
if max(Ni0(:,i))>0
|
|
|
|
|
text(uidx(120),0.9,strcat('$\N{',num2str(i-1),'}{',num2str(p-2),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 3
|
|
|
|
|
line=myLineThree;
|
|
|
|
|
if max(Ni0(:,i))>0
|
|
|
|
|
text(0,0.9,strcat('$\N{',num2str(i-1),'}{',num2str(p-2),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 4
|
|
|
|
|
line=myLineFour;
|
|
|
|
|
if max(Ni0(:,i))>0
|
|
|
|
|
text(uidx(220),0.9,strcat('$\N{',num2str(i-1),'}{',num2str(p-2),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 5
|
|
|
|
|
line=myLineFive;
|
|
|
|
|
if max(Ni0(:,i))>0
|
|
|
|
|
text(uidx(320),0.9,strcat('$\N{',num2str(i-1),'}{',num2str(p-2),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 6
|
|
|
|
|
line=myLineSix;
|
|
|
|
|
if max(Ni0(:,i))>0
|
|
|
|
|
text(uidx(420),0.9,strcat('$\N{',num2str(i-1),'}{',num2str(p-2),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 7
|
|
|
|
|
line=myLineSeven;
|
|
|
|
|
if max(Ni0(:,i))>0
|
|
|
|
|
text(0,0.9,strcat('$\N{',num2str(i-1),'}{',num2str(p-2),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
case 8
|
|
|
|
|
line=myLineOne;
|
|
|
|
|
if max(Ni0(:,i))>0
|
|
|
|
|
text(0,0.9,strcat('$\N{',num2str(i-1),'}{',num2str(p-2),'}$'));
|
|
|
|
|
boolSwitch = true;
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
%Punkte generieren:
|
|
|
|
|
if boolSwitch
|
|
|
|
|
plot(uidx,Ni0(:,i),'LineStyle','-','Color',line)
|
|
|
|
|
axeshandle = findall(f0, 'type', 'axes');
|
|
|
|
|
set(axeshandle,'YLim',[0,1.1]);
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
matlab2tikz('filename','plot_Basisfunktionen2.tex',...
|
|
|
|
|
'height', '\figureheight', 'width', '\figurewidth', 'encoding', 'UTF8', 'showInfo', false, 'checkForUpdates', false, ...
|
|
|
|
|
'figurehandle',f2,...
|
|
|
|
|
'parseStrings', false, ... % switch off LaTeX parsing by matlab2tikz for titles, axes labels etc. ("greater flexibility", "use straight LaTeX for your labels")
|
|
|
|
|
'floatFormat', '%.4g', ... % limit precision to get smaller .tikz files
|
|
|
|
|
'noSize', false);
|
|
|
|
|
matlab2tikz('filename','plot_Basisfunktionen1.tex',...
|
|
|
|
|
'height', '\figureheight', 'width', '\figurewidth', 'encoding', 'UTF8', 'showInfo', false, 'checkForUpdates', false, ...
|
|
|
|
|
'figurehandle',f1,...
|
|
|
|
|
'parseStrings', false, ... % switch off LaTeX parsing by matlab2tikz for titles, axes labels etc. ("greater flexibility", "use straight LaTeX for your labels")
|
|
|
|
|
'floatFormat', '%.4g', ... % limit precision to get smaller .tikz files
|
|
|
|
|
'noSize', false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
matlab2tikz('filename','plot_Basisfunktionen0.tex',...
|
|
|
|
|
'height', '\figureheight', 'width', '\figurewidth', 'encoding', 'UTF8', 'showInfo', false, 'checkForUpdates', false, ...
|
|
|
|
|
'figurehandle',f0,...
|
|
|
|
|
'parseStrings', false, ... % switch off LaTeX parsing by matlab2tikz for titles, axes labels etc. ("greater flexibility", "use straight LaTeX for your labels")
|
|
|
|
|
'floatFormat', '%.4g', ... % limit precision to get smaller .tikz files
|
|
|
|
|
'noSize', false);
|
|
|
|
|
|
|
|
|
|
|