Hello,
I have a Nx2 .dat file which I import to Matlab as a Nx2 matrix. This .dat file is roughly a collection of [x,y] coordinates of a curve.
What I am trying to do is to obtain not only the curve that intepolates those point but also its form in symbolic code.
My code is the following
clcclear all%Importing .dat file and converting to a nx2 matrix
f = fopen('GITT_bi1g20.dat');data = textscan(f, '%f %f');data = cell2mat(data); % convert to matrix from cell array
fclose(f);%Comparison between different interpolation functions
%Polynomial
x = data(:,1);y = data(:,2);p = polyfit(x,y,9);y1 = polyval(p,x);%pchip() - Hermitian
xx = x;p = pchip(x,y,xx);figure(1)hold onplot(data(:,1),data(:,2),'m')plot(xx,p,'--black')hold off
My biggest wish is actually write the pchip() that intepolates the data points as a symbolic function. (So I can do some Calculus stuff with it and other symbolic functions I am using)
Thanks in advance.
Best Answer