Project - Data Handling and Interpolation
PROJECT
DATA HANDLING AND INTERPOLATION
clear;
clc;
d = readmatrix('VI .xlsx'); % reading excel file data
v = d(:,1); % voltage data
i = d(:,2); % current data
vp=-17.3:0.1:0.9;
zx1=interp1(v,i,vp); % linear interpolation
zx2=interp1(v,i,vp,'spline'); % spline interpolation
figure(1)
plot(v,i,'r+',vp,zx1,': b.'); %using plot command to plot
title('Linear Interpol');
xlabel('Voltage (V)');
ylabel('Current (I)');
grid on;
figure(2)
plot(v,i,'p',vp,zx2,'m: .'); %using plot command to plot
title('spline');
xlabel('Voltage (V)');
ylabel('Current (I)');
grid on;
filename = fopen('project_4_output.txt','w');
fprintf(filename,'%f \t',vp,zx2);
fclose(filename);
OUTPUT txt :
-17.300000 -17.200000 -17.100000 -17.000000 -16.900000 -16.800000 -16.700000 -16.600000 -16.500000 -16.400000 -16.300000 -16.200000 -16.100000 -16.000000 -15.900000 -15.800000 -15.700000 -15.600000 -15.500000 -15.400000 -15.300000 -15.200000 -15.100000 -15.000000 -14.900000 -14.800000 -14.700000 -14.600000 -14.500000 -14.400000 -14.300000 -14.200000 -14.100000 -14.000000 -13.900000 -13.800000 -13.700000 -13.600000 -13.500000 -13.400000 -13.300000 -13.200000 -13.100000 -13.000000 -12.900000 -12.800000 -12.700000 -12.600000 -12.500000 -12.400000 -12.300000 -12.200000 -12.100000 -12.000000 -11.900000 -11.800000 -11.700000 -11.600000 -11.500000 -11.400000 -11.300000 -11.200000 -11.100000 -11.000000 -10.900000 -10.800000 -10.700000 -10.600000 -10.500000 -10.400000 -10.300000 -10.200000 -10.100000 -10.000000 -9.900000 -9.800000 -9.700000 -9.600000 -9.500000 -9.400000 -9.300000 -9.200000 -9.100000 -9.000000 -8.900000 -8.800000 -8.700000 -8.600000 -8.500000 -8.400000 -8.300000 -8.200000 -8.100000 -8.000000 -7.900000 -7.800000 -7.700000 -7.600000 -7.500000 -7.400000 -7.300000 -7.200000 -7.100000 -7.000000 -6.900000 -6.800000 -6.700000 -6.600000 -6.500000 -6.400000 -6.300000 -6.200000 -6.100000 -6.000000 -5.900000 -5.800000 -5.700000 -5.600000 -5.500000 -5.400000 -5.300000 -5.200000 -5.100000 -5.000000 -4.900000 -4.800000 -4.700000 -4.600000 -4.500000 -4.400000 -4.300000 -4.200000 -4.100000 -4.000000 -3.900000 -3.800000 -3.700000 -3.600000 -3.500000 -3.400000 -3.300000 -3.200000 -3.100000 -3.000000 -2.900000 -2.800000 -2.700000 -2.600000 -2.500000 -2.400000 -2.300000 -2.200000 -2.100000 -2.000000 -1.900000 -1.800000 -1.700000 -1.600000 -1.500000 -1.400000 -1.300000 -1.200000 -1.100000 -1.000000 -0.900000 -0.800000 -0.700000 -0.600000 -0.500000 -0.400000 -0.300000 -0.200000 -0.100000 0.000000 0.100000 0.200000 0.300000 0.400000 0.500000 0.600000 0.700000 0.800000 0.900000 -28.000000 -28.173426 -24.000000 -19.000000 -15.868529 -14.000000 -12.235337 -10.502216 -9.000000 -7.880609 -7.106199 -6.591485 -6.251180 -6.000000 -5.767031 -5.538852 -5.316414 -5.100668 -4.892566 -4.693058 -4.503096 -4.323632 -4.155616 -4.000000 -3.857400 -3.727091 -3.608015 -3.499111 -3.399322 -3.307586 -3.222845 -3.144041 -3.070112 -3.000000 -2.932800 -2.868222 -2.806131 -2.746392 -2.688869 -2.633427 -2.579931 -2.528246 -2.478236 -2.429766 -2.382701 -2.336905 -2.292243 -2.248580 -2.205780 -2.163709 -2.122230 -2.081210 -2.040511 -2.000000 -1.959575 -1.919277 -1.879178 -1.839354 -1.799878 -1.760825 -1.722269 -1.684284 -1.646943 -1.610323 -1.574496 -1.539536 -1.505519 -1.472517 -1.440606 -1.409859 -1.380351 -1.352156 -1.325347 -1.300000 -1.276161 -1.253771 -1.232744 -1.212993 -1.194431 -1.176973 -1.160531 -1.145020 -1.130352 -1.116443 -1.103204 -1.090550 -1.078395 -1.066651 -1.055233 -1.044054 -1.033028 -1.022067 -1.011087 -1.000000 -0.988735 -0.977282 -0.965646 -0.953831 -0.941843 -0.929686 -0.917366 -0.904886 -0.892253 -0.879470 -0.866543 -0.853477 -0.840276 -0.826946 -0.813490 -0.799915 -0.786225 -0.772424 -0.758518 -0.744512 -0.730411 -0.716218 -0.701940 -0.687581 -0.673146 -0.658640 -0.644067 -0.629433 -0.614742 -0.600000 -0.585216 -0.570422 -0.555654 -0.540949 -0.526342 -0.511871 -0.497572 -0.483481 -0.469636 -0.456071 -0.442824 -0.429932 -0.417430 -0.405355 -0.393744 -0.382633 -0.372059 -0.362057 -0.352665 -0.343919 -0.335855 -0.328510 -0.321920 -0.316122 -0.311152 -0.307046 -0.303842 -0.301575 -0.300282 -0.300000 -0.300694 -0.302051 -0.303685 -0.305213 -0.306249 -0.306409 -0.305308 -0.302562 -0.297786 -0.290596 -0.280606 -0.267433 -0.250692 -0.229998 -0.204966 -0.175212 -0.140352 -0.100000 -0.055889 -0.018218 0.000705 -0.000162 0.000228 0.012852 0.170000 1.230000 10.043338 39.070057 101.110222