Project - Data Handling and Interpolation
Solution:
Code:
A=[]; V=[]; I=[];%Initializing values
A= xlsread('VI.xlsx');%Reading values from matrix
V=A(:,1);%Taking the value of Voltage from the excel
I=A(:,2);%Taking the value of Current from the excel
Vnew=-17.3:0.1:0.9;%Setting the range of voltage for ineterpolation
Inew=interp1(V,I,Vnew);%interpolating the value of I
figure(1);
fptr=fopen('VI_interpolated.txt','w');%opeing the text file using the file pointer 'fptr'
fprintf(fptr, 'Vnew \t \t Inew \n');%writing to the text file
fprintf(fptr, '%f \t %f \n',Vnew,Inew);%writing the interpolated values to the text file
plot(V,I,'b');%plotting the original values
grid;
hold;
plot(Vnew,Inew,'go');%plotting the interpolated values
xlabel('V (Volts)');
ylabel('I (mAmps)');
title('VI Graph');
legend('Original','Interpolated');
Output:

