generating and plotting a matrix of bsplines with different positions and width

1 Ansicht (letzte 30 Tage)
I am able to create a set of bsplines in a single plot. However, I would like to create a matrix of individual bsplines, whereby each matrix row contains a single bspline from range 1950 to 20150, in the way depicted in the drawing. The bsplines should have the same height with coefficient of 1. The next bspline in the library will be spaced one knot apart from the first bspline and so on until the entire width is taken, depending on the width of the bspline. Then, starting from the left-most again, a bspline of twice the width of the previous bspline is added to the reference set. Then a bspline for the same width is added 1 knot apart from the first and so on… This process will continue until the bspline become so wide that one bspline is able to fit the entire width.
Also, a bonus question: is there any nice functions for plotting all the functions described above in a way similar to the drawing?
B = spcol([0, 0, 0, linspace(0,1,20), 1, 1, 1], 4, linspace(0,1,100)); plot(B);

Antworten (1)

Matt J
Matt J am 17 Jul. 2021
  8 Kommentare
Tim Dong
Tim Dong am 28 Aug. 2021
@Matt J, this is great work. I think I am getting the bsplines I need. However, I would like the height of the bsplines to be set to 1 instead of it currently being ~0.67. My code are shown below as well.
cubicBspline = @(t) (t>-1 & t<1).*(2/3 - t.^2 +abs(t).^3/2) +...
(abs(t)>=1 & abs(t)<2).*((2-abs(t)).^3/6);
tCoarse=linspace(-1.2, 1.2,9); %Coarse sample locations on t-axis
dtCoarse=tCoarse(2)-tCoarse(1);
tFine=linspace(-1.2, 1.2,81); %Fine sample locations on t-axis
dtFine=tFine(2)-tFine(1);
SampRatio=round(dtCoarse/dtFine); %Sampling ratio
%sample the signal
% sCoarse=s(tCoarse(:));
% sFine=s(tFine(:));
%
% figure; subplot(1,2,1)
% plot(tFine,sFine,'-b', tCoarse,sCoarse,'r*');
% legend('True Signal', 'Control Points');
% title 'Signal Samples'
%%Engine
kernel=cubicBspline(-2:1/SampRatio:2 );
nCtrlPts=length(tCoarse);
%create interpolation system matrices
%BasisFine=interpMatrix(kernel, 'max', nCtrlPts, SampRatio, 'mirror');
BasisFine=interpMatrix(kernel, 'max', nCtrlPts, SampRatio);
%BasisCoarse=BasisFine(1:SampRatio:end,:);
plot(BasisFine)
kernel=cubicBspline(-2:1/5:2 );
nCtrlPts=length(tCoarse);
%BasisFine=interpMatrix(kernel, 'max', nCtrlPts, 5);
BasisFine=interpMatrix(kernel, 'max', nCtrlPts, 5, 'allcontrib');
%BasisCoarse=BasisFine(1:SampRatio:end,:);
plot(1:10, BasisFine(1:10,1))
plotColors = jet(20);
%TD: multi-resolution bspline plot
subplot(1,1,1)
hold on; plot(((1:19)./4 ), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +1), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +2), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +3), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +4), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +5), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +6), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +7), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +8), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +9), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +10), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +11), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +12), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +13), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +14), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
hold on; plot(((1:19)./4 +15), BasisFine(2:20,5),'Color', plotColors(2,:)); hold off
Matt J
Matt J am 28 Aug. 2021
However, I would like the height of the bsplines to be set to 1 instead of it currently being ~0.67
Could you not just multiply the matrix by 3/2

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by