Project - Data Handling and Interpolation
% reading the excel data
voltage = xlsread('VI.xlsx',1,'A2:A25');
current = xlsread('VI.xlsx',1,'B2:B25');
title('voltage vs current');
xlabel('voltage');ylabel('current');
%for interpolaton
xq = -17:0.1:0.9 ;
xq1 = interp1(voltage,current,xq,'spline');
%plotting the data
plot(voltage,current,'o');grid;
hold on;
plot(xq,xq1,'k');
% finding the unkonown values of current
vol_find = xlsread('VI.xlsx',2,'A1:A11');
len = length(vol_find);
cur_find = [];
for i=1:len
c = interp1(voltage,current,vol_find(i));
cur_find = [cur_find c];
end;
%writing the current vlaues to a text file
file = fopen('cur_values.txt','w');
fprintf(file,'%d\n',cur_find);