Project - Data Handling and Interpolation
% to read the excel file i use 'xlsread' function.
num = xlsread('VI.xlsx') // reading file
% but here i use drag and drop method because it is easier for me.
>> ImAmp
ImAmp =
-28.0000
-24.0000
-19.0000
-14.0000
-9.0000
-6.0000
-4.0000
-3.0000
-2.0000
-1.3000
-1.0000
-0.6000
-0.3000
-0.1000
0
0
0
0.0100
0.0300
0.1700
0.4200
1.2300
1.9900
>> VVolt
VVolt =
-17.3000
-17.1000
-17.0000
-16.8000
-16.5000
-16.0000
-15.0000
-14.0000
-12.0000
-10.0000
-8.0000
-5.0000
-2.0000
-0.2000
0.0900
0.1900
0.2700
0.3900
0.4300
0.5000
0.5500
0.6000
0.6200
>> xv
xv =
-17.2000
-13.0000
-11.0000
-9.0000
-6.0000
-1.0000
0.1100
0.2500
0.5000
0.6100
0.6600
>> yq1 = interp1(VVolt,ImAmp,xv); // linnear innterpolation
>>plot(VVolt,ImAmp,'o',xv,yq1,':.');grid;xlabel('Volt');ylabel('Amp');title('Linnear Interpolation(VI curve)'); %polting VI curve using the excel data.
>> yq2 = interp1(VVolt,ImAmp,xv,'spline'); Spline Innterpolation
>> plot(VVolt,ImAmp,'o',xv,yq2,':.');grid;xlabel('Volt');ylabel('Amp');title('Spline Interpolation(VI curve)');
%polting VI curve using the excel data.
% for values of Voltages VV we found the respected values of current from the VI curve and the values are written Below
>>I = [-28.1734 -24 -7.3333204 -5.4945 -2.42977 -2.22490525 -1.61032 -1.11644 -0.722722443 -0.744512 -0.290597 0.00115007 -0.000136662 0.17 1.56681];
>> I
I =
Columns 1 through 12
-28.1734 -24.0000 -7.3333 -5.4945 -2.4298 -2.2249 -1.6103 -1.1164 -0.7227 -0.7445 -0.2906 0.0012
Columns 13 through 15
-0.0001 0.1700 1.5668
%for writing the values of current in text file i use these code
>> fileID = fopen('I.txt','w');
>> write = fprintf(fileID,'%5d %5d %5d %5d\n',I)
write =
199
>> fclose(fileID);