plz can you do for a cubic spline using large yields data for estimating yields curve.I am having many difficulties in estimating yield curve.Would be grateful to you.Thank you
I need a help regarding how to import csv data without empty cells....please make a video on that cause only reading csv data is explained in thousand ways over net but how to deal with the blank cells in csv file isn't explained anywhere...at least i didn't find it.
Who else felt extremely satisfied when he plotted the quadratic spline in the end?
Thanks so much for this. This was incredibly helpful.
Thanks for the detailed explainations! Very helpful! Head to cubic splines now!
ruclips.net/video/gfSKOfHRooQ/видео.html
Great video. Would you please share your codes for quadratic spline?
clear
clc
close all
X = (-10:10)';
Y = sin(5*X);% + rand(length(X),1);
fig = figure();
set(fig,'color','white')
set(gca,'FontSize',18)
p0 = plot(X,Y,'b*','MarkerSize',10);
xlabel('X')
ylabel('Y')
grid on
hold on
%%%Linear Splines
for idx = 1:length(X)-1
m = (Y(idx+1)-Y(idx) )/(X(idx+1)-X(idx));
xspline = linspace(X(idx),X(idx+1),10);
yspline = m*(xspline-X(idx)) + Y(idx);
p1 = plot(xspline,yspline,'g-','LineWidth',2);
end
%%%Quadratic Splines
N = length(X);
n = N-1;
%%%%Create H0 = [2*(n-1) x 3*n]
H0 = zeros(2*n-2,3*n);
K0 = zeros(2*n-2,1);
for idx = 1:(n-1)
col = idx;
row = 2*(idx-1)+1;
H0(row,col) = X(idx+1)^2;
H0(row+1,col+1) = X(idx+1)^2;
H0(row,n+col) = X(idx+1);
H0(row+1,n+col+1) = X(idx+1);
H0(row,2*n+col) = 1;
H0(row+1,2*n+col+1) = 1;
K0(row) = Y(idx+1);
K0(row+1) = Y(idx+1);
end
%%%Create H1 = [n-1 x 3*n];
H1 = zeros(n-1,3*n);
for idx = 1:n-1
H1(idx,idx) = 2*X(idx+1);
H1(idx,idx+1) = -2*X(idx+1);
H1(idx,n+idx) = 1;
H1(idx,n+idx+1) = -1;
end
%%%Create HE
HE = zeros(2,3*n);
HE(1,1) = X(1)^2;
HE(1,n+1) = X(1);
HE(1,2*n+1) = 1;
HE(2,n) = X(end)^2;
HE(2,2*n) = X(end);
HE(2,end) = 1;
%%%Compute H
H = [H0;H1;HE];
[r,c] = size(H);
%%%Compute K
K = zeros(r,1);
K(1:(2*(n-1))) = K0;
K(end-1) = Y(1);
K(end) = Y(end);
%%%Assume now that a1 = 0
H = H(:,2:end);
coeffs = inv(H)*K
%%%Get all your A's,B's, and C's
A = [0;coeffs(1:n-1)]
B = coeffs(n:2*n-1)
C = coeffs(2*n:end)
%%%%Plot the results
for idx = 1:n
xspline = linspace(X(idx),X(idx+1),10);
yspline = A(idx)*xspline.^2 + B(idx)*xspline + C(idx);
p2 = plot(xspline,yspline,'r-','LineWidth',2);
end
legend([p0 p1 p2],'Measured Data','Linear Spline','Quadratic Spline')
Monte Carlos nice
write a MATLAB strip to solve the polynomial
p(x)=2x^5-3x^4+7x^3-x^2+5x-6=0
Can you please help me with this?
Can you use the fzero function?
plz can you do for a cubic spline using large yields data for estimating yields curve.I am having many difficulties in estimating yield curve.Would be grateful to you.Thank you
It's on my to-do list. Cubic splines are just very complex so I haven't gotten around to it. I will try and upload it this weekend if I have time.
@@cjcar178 ruclips.net/video/gfSKOfHRooQ/видео.html
I need a help regarding how to import csv data without empty cells....please make a video on that cause only reading csv data is explained in thousand ways over net but how to deal with the blank cells in csv file isn't explained anywhere...at least i didn't find it.
Can you copy and paste an example csv file?
Have you tried this? ruclips.net/video/_Lnnw9WLntE/видео.html
or this? ruclips.net/video/L-pBWbNWJtY/видео.html
www.sharecsv.com/s/e850a3da764bb3c44f71e03482117670/shampoo.csv
Actually i solved it in a naive way....using for loop and checking for values ~=0, if this condition was satisfied then i copied data in a new vector.
plz do it for cubic spline
adnan najum sure. I'll add it to my to-do list
ruclips.net/video/gfSKOfHRooQ/видео.html
Please give me away program the solve of the linear and quadratic splines please.
All my codes on splines are in this folder as of 6/14/2021
github.com/cmontalvo251/MATLAB/tree/master/Screen_Cast_Codes/Interpolation
@@CarlosMontalvo251 thank you so much 🌹🌹
Can you email
I prefer to respond to youtube comments.