

clc % clearing the workspace.
file=xlsread('VI.xlsx'); % to read excel file
format compact % format used
V=file(:,1);
I=file(:,2);
X=17.3:0.1:0.9; % given interpolation range
Y=interp1(V,I,X,'spline'); % spline interpolation between V & I
subplot(211);
plot(V,I,'O',X,Y); % plot the graph
grid on
title('voltage vs cureent'); % title for the graph
xlabel('voltage'); % x-axis label
ylabel('current'); % y-axis label
grid on
VV=[-17.2 % VV range
-13
-11
-9
-6
-1
0.11
0.25
0.5
0.61
0.66];
II=interp1(V,I,VV); % interpolation of V & I.
Z=[VV II];
fileId=fopen('VVII.txt','w'); % save text file by name of 'VVII.txt'.
fprintf(fileId,'%6s%12s\n','VV','II'); % print the data of VV,II
fprintf(fileId,'%6.2f%12.8f\n',Z); % print the data of Z
fclose(fileId); % close the file
