Project - Data Handling and Interpolation
load Project.mat % I used different method to import excel file
VV = Project.VVolt;% assiging value for voltage and current from excel file
Im = Project.ImAmp;
vinp=[-17.3:0.1:0.9];% Given Data
linp=interp1(VV,Im,vinp,"spline");%using Interpolation function
figure(1);
subplot(121)
plot(VV,Im,'-o');grid;
title('Normal Data');
xlabel('volt');ylabel('Im');
v=[-20 5 -30 10];
subplot(122);
plot(VV,Im,'o',vinp,linp);grid;%
title('By Interpolation Data');
xlabel('volt');ylabel('Im');
VV1=[-17.2 -17.1 -13.8 -13.5 -12.5 -11 -9 -5.76 -6 -1 0.11 0.25 0.5 0.61];
I1=interp1(VV,Im,VV1);
figure(2);
plot(VV1,I1,'o--');grid;
title('New Given data');
VVI2=[VV1;I1];
fid=fopen('answer.txt','w');
fprintf(fid,'%6s %12s\n','Voltage','Current');
fprintf(fid,'%6.2f %12.8f\n',VVI2);
fclose(fid);

