Project - Data Handling and Interpolation
%Voltage and Current Data from VI.xlsx file is extracted using read matrix
%function as well as the time range is set according to the given range
%initially interp1 command is used by default after that spline operation
%added to the interp1 to differentiate the linear interpolated data and
%spline interpolated data both data are plotted in different figures and
%both data are stored in different text files
V = readmatrix('VI.xlsx','Sheet',1,'Range','A2:A25');
I = readmatrix('VI.xlsx','Sheet',1,'Range','B2:B25');
T = -17.3:0.1:0.9;
Y = interp1(V,I,T);%linear interpolation
Y1 = interp1(V,I,T,'spline');%spline interpolation
figure(1);
plot(V,I,'b-',Y,T,'r-');
title('linear interplation');
grid;
figure(2);
plot(V,I,'m-',Y1,T,'g-');
grid;
title('spline interpolated');
writematrix(Y,'interpolated_data.txt','Delimiter',' ');%delimiter is used to separate columns with space
writematrix(Y1,'spline_interpolated_data.txt','Delimiter',' ');