Project - Data Handling and Interpolation
[n]= xlsread('VI.xlsx'); %read the xlsx file and store in n
V=n(:,1); % Define V as column 1 of matrix
I=n(:,2); % Define I as column 2 of matrix
x=(-17.3:0.1:0.9); % creating given range of voltage data mentioned in problem
y=interp1(V,I,x,'spline'); %using spline interpolation y values wrt x using exiting 'V' and 'I'
plot(V,I,'o',x,y); % Ploting plot for the interpolated data
grid on
title('voltage and current');
xlabel ('volage');
ylabel('current');
VV=[-17.2 -17.1 -13.8 -13.5 -13.0 -12.5 -11 -9 -5.76 -6 -1 0.11 0.25 0.5 0.61]; % New voltage range
T=interp1(V,I,VV,'spline'); % Linear interpolation for find value of current
z=[VV,T] % saving values
fid=fopen('VI.txt','w');
fprintf(fid,'%5s %10s\n','VV','I'); % Title for voltage and current
fprintf(fid,'%5f %5f\n',VV,T); % save data for voltage and current
fclose(fid);