Project - Data Handling and Interpolation
1.
lab_data = xlsread("VI.xlsx"); %reading data from .xls file
V = lab_data(:,1); %storing the voltage
I = lab_data(:,2); %storing the current
r = [-17.3:0.1:0.9]; %setting the range
inter = interp1(V,I,r); %using interpolation function
plot(V,I,'o',r,inter,'b--'); %to plot the graph
grid;
title('Interpolated data');
xlabel('I');
ylabel('V');
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];
h = V / I; %equation to find resistance
R = h(:,1); %storing resistance
j = VV / R; %equation to find current
II = j(:,1); %storing current
new = fopen('VVII.txt','w'); %openingn a .txt file
fprintf(new,'Voltage \n'); %writing the .txt file
fprintf(new,'%f \n',VV);
fprintf(new,'\n Current \n');
fprintf(new,'%f \n',II);
fclose(new); %closing the .txt file

