Project - Data Handling and Interpolation
Script File:
Data=xlsread('VI.xlsx'); % Command used to open the given Excel file
V=Data(:,1); % Assigning the voltages values to the variable V
I=Data(:,2); % Assigning the current values to the variable I
VV=[-17.3:0.1:0.9]; % The given voltage interpolation range
II=interp1(V,I,VV); % Implementing one-dimensional interpolation
plot(V,I,'b-',VV,II,'m--'); %Command used to plot the original and the interpolated data
grid; % To apply grids on the plot
xlabel('Voltage (V)'); % To name the x-axis
ylabel('Current (mA)'); %To name the y-axis
title('Interpolation Graph'); % To give a title for the chart
legend('Original','Interpolation'); % To give each curve a name (or legend)
Interpolation (:,1)=VV; % VV data is stored in the first column of Interpolation matrix
Interpolation (:,2)=II; % II is stored in the second column of Interpolation matrix
fid=fopen('Interpolation.txt','w'); % To open a text file named "Interpolation"
writematrix(Interpolation,"Interpolation.txt"); % Command used to write the matrix to the text file
Results:
Interpolated current and voltage values,
-17.3,-28
-17.2,-26
-17.1,-24
-17,-19
-16.9,-16.5
-16.8,-14
-16.7,-12.3333333333333
-16.6,-10.6666666666667
-16.5,-9
-16.4,-8.40000000000001
-16.3,-7.8
-16.2,-7.2
-16.1,-6.60000000000001
-16,-6
-15.9,-5.8
-15.8,-5.6
-15.7,-5.4
-15.6,-5.2
-15.5,-5
-15.4,-4.8
-15.3,-4.6
-15.2,-4.4
-15.1,-4.2
-15,-4
-14.9,-3.9
-14.8,-3.8
-14.7,-3.7
-14.6,-3.6
-14.5,-3.5
-14.4,-3.4
-14.3,-3.3
-14.2,-3.2
-14.1,-3.1
-14,-3
-13.9,-2.95
-13.8,-2.9
-13.7,-2.85
-13.6,-2.8
-13.5,-2.75
-13.4,-2.7
-13.3,-2.65
-13.2,-2.6
-13.1,-2.55
-13,-2.5
-12.9,-2.45
-12.8,-2.4
-12.7,-2.35
-12.6,-2.3
-12.5,-2.25
-12.4,-2.2
-12.3,-2.15
-12.2,-2.1
-12.1,-2.05
-12,-2
-11.9,-1.965
-11.8,-1.93
-11.7,-1.895
-11.6,-1.86
-11.5,-1.825
-11.4,-1.79
-11.3,-1.755
-11.2,-1.72
-11.1,-1.685
-11,-1.65
-10.9,-1.615
-10.8,-1.58
-10.7,-1.545
-10.6,-1.51
-10.5,-1.475
-10.4,-1.44
-10.3,-1.405
-10.2,-1.37
-10.1,-1.335
-10,-1.3
-9.9,-1.285
-9.8,-1.27
-9.7,-1.255
-9.6,-1.24
-9.5,-1.225
-9.4,-1.21
-9.3,-1.195
-9.2,-1.18
-9.1,-1.165
-9,-1.15
-8.9,-1.135
-8.8,-1.12
-8.7,-1.105
-8.6,-1.09
-8.5,-1.075
-8.4,-1.06
-8.3,-1.045
-8.2,-1.03
-8.1,-1.015
-8,-1
-7.9,-0.986666666666667
-7.8,-0.973333333333333
-7.7,-0.96
-7.6,-0.946666666666667
-7.5,-0.933333333333333
-7.4,-0.92
-7.3,-0.906666666666667
-7.2,-0.893333333333333
-7.1,-0.88
-7,-0.866666666666667
-6.9,-0.853333333333333
-6.8,-0.84
-6.7,-0.826666666666667
-6.6,-0.813333333333333
-6.5,-0.8
-6.4,-0.786666666666667
-6.3,-0.773333333333333
-6.2,-0.76
-6.1,-0.746666666666667
-6,-0.733333333333333
-5.9,-0.72
-5.8,-0.706666666666667
-5.7,-0.693333333333333
-5.6,-0.68
-5.5,-0.666666666666667
-5.4,-0.653333333333333
-5.3,-0.64
-5.2,-0.626666666666667
-5.1,-0.613333333333333
-5,-0.6
-4.9,-0.59
-4.8,-0.58
-4.7,-0.57
-4.6,-0.56
-4.5,-0.55
-4.4,-0.54
-4.3,-0.53
-4.2,-0.52
-4.1,-0.51
-4,-0.5
-3.9,-0.49
-3.8,-0.48
-3.7,-0.47
-3.6,-0.46
-3.5,-0.45
-3.4,-0.44
-3.3,-0.43
-3.2,-0.42
-3.1,-0.41
-3,-0.4
-2.9,-0.39
-2.8,-0.38
-2.7,-0.37
-2.6,-0.36
-2.5,-0.35
-2.4,-0.34
-2.3,-0.33
-2.2,-0.32
-2.1,-0.31
-2,-0.3
-1.9,-0.288888888888889
-1.8,-0.277777777777778
-1.7,-0.266666666666667
-1.6,-0.255555555555556
-1.5,-0.244444444444445
-1.4,-0.233333333333333
-1.3,-0.222222222222222
-1.2,-0.211111111111111
-1.1,-0.2
-1,-0.188888888888889
-0.9,-0.177777777777778
-0.8,-0.166666666666667
-0.7,-0.155555555555556
-0.6,-0.144444444444444
-0.5,-0.133333333333333
-0.4,-0.122222222222222
-0.3,-0.111111111111111
-0.2,-0.1
-0.1,-0.0655172413793104
0,-0.0310344827586207
0.1,0
0.2,0
0.3,0.00249999999999999
0.4,0.015
0.5,0.17
0.6,1.23
0.7,NaN
0.8,NaN
0.9,NaN
