Project - Data Handling and Interpolation
Project :
In a laboratory experiment, data of voltage and current has been recorded and the same is attached in an excel file ( VI.xlsx ). Read the excel file in the Matlab program and perform the interpolation in the range of -17.3:0.1:0.9. Generate the interactive plot for the interpolated data. Additionally, compute the current values for given voltages below and store them in a text file.
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]’
Matlab Script:
clc %clear command
close all % close all
clear all
V=xlsread('VI.xlsx','A2:A25'); %read the specific voltage value from excel sheet
I=xlsread('VI.xlsx','B2:B25'); %read the specific current value from excel sheet
x = -17.3:0.1:0.9; %interpolation range
y = interp1(V,I,x,'spline'); %interpolation of V & I
plot(V,I,'o',x,y,'-'); % plot the graph
grid on
title('voltage vs current'); % title of graph
legend('data & interpolation'); %legend of plot
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];
i=interp1(V,I,vv); % interploation of V & I
z=[vv i]
fid=fopen('interpolation.txt', 'w'); % save text file by name interpolation
fprintf(fid,'%d\n',z); %print the data of z
fclose(fid); % close the file

=======
The excel sheet data was imported and assigned a particular variable for futher refrence . We hereby have mentioned a specific cell no so that the values are not randomly picked up.
then the interpolation points given in question are assigned and the same values are plotted.
the lot is given a x , y , title label for understanding purpose.
next the vv data is also consider and this data is is interperated the values obytain are moved to txt file by command fopen and fprint,
The script was ran succesfully without any eror the below are plots and results.
PLOt:

2 points are selected so cross verify our table and plot .
COMMAND WINDOW:

TEXT OUTPUT :
-1.720000e+01
-13
-11
-9
-6
-1
1.100000e-01
2.500000e-01
5.000000e-01
6.100000e-01
6.600000e-01
-2.600000e+01
-2.500000e+00
-1.650000e+00
-1.150000e+00
-7.333333e-01
-1.888889e-01
0
0
1.700000e-01
1.610000e+00
NaN
ALL THE FILES ARE ATTACHED IN THE PROJECT.