Project - Data Handling and Interpolation
Program:
J=readmatrix('VI.xlsx'); % Reading the excel file
V=J(:,1); % Reading the excel files 1st coloumn Value of voltage
I=J(:,2); % Reading the excel files 2nd coloumn Value of current
h1=-17.3:0.1:0.9;
T1=interp1(V,I,h1,"linear");
T2=interp1(V,I,h1,"spline");
figure(1);
plot(V,I,h1,T1,'r*');
grid;
xlabel('Altitude');
ylabel('Temperature');
title('linear Interpolation');
legend('Origional','L-Interpolation');
figure(2);
plot(V,I,h1,T2,'r*');
grid;
xlabel('Altitude');
ylabel('Temperature');
title('Spline Interpolation');
legend('Origional','SP-Interpolation');
% Write interpolated data in txt file
fileID = fopen('VIsavtextfile.txt','W'); %saving file in text file
fprintf(fileID,'%8s %10s\n','V(volt)','I(mAmp)');
fprintf(fileID,'%f %f\n',T2);
fclose(fileID);