Project - Data Handling and Interpolation
SOLUTION;
clc
clear all
A=xlsread('VI1.xlsx');% to read the xl file
V = A(:,1);% calling the first column elements
I = A(:,2);% calling the second column elements
c=-17.3:0.1:0.9;% the given range of data
B=interp1(V,I,c);% interpolation in between the given data limit
plot(V,I,'o',c,B,'r:');% plotting the voltage,current using 'o' lines and c,B using red doted lines
z= [c B];% matrix including the values of c and B
figure(1)
title('interpolation');% providing the title interpolation
xlabel('voltage');ylabel('current');% labelling voltage and current in the x and y axis respectively
fid=fopen('voltage_current.txt','w');% creating file using fopen command filename and writing to text file.
fprintf(fid,'%10s %20s \n','B','c');% printing the interpolatted values and data in the range of 'c' in two columns
fprintf(fid,'%10f %20f \n',z);% printing the values in z matrix
MISSING DATA;saved in text
B c
-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
-26.000000 -24.000000
-19.000000 -16.500000
-14.000000 -12.333333
-10.666667 -9.000000
-8.400000 -7.800000
-7.200000 -6.600000
-6.000000 -5.800000
-5.600000 -5.400000
-5.200000 -5.000000
-4.800000 -4.600000
-4.400000 -4.200000
-4.000000 -3.900000
-3.800000 -3.700000
-3.600000 -3.500000
-3.400000 -3.300000
-3.200000 -3.100000
-3.000000 -2.950000
-2.900000 -2.850000
-2.800000 -2.750000
-2.700000 -2.650000
-2.600000 -2.550000
-2.500000 -2.450000
-2.400000 -2.350000
-2.300000 -2.250000
-2.200000 -2.150000
-2.100000 -2.050000
-2.000000 -1.965000
-1.930000 -1.895000
-1.860000 -1.825000
-1.790000 -1.755000
-1.720000 -1.685000
-1.650000 -1.615000
-1.580000 -1.545000
-1.510000 -1.475000
-1.440000 -1.405000
-1.370000 -1.335000
-1.300000 -1.285000
-1.270000 -1.255000
-1.240000 -1.225000
-1.210000 -1.195000
-1.180000 -1.165000
-1.150000 -1.135000
-1.120000 -1.105000
-1.090000 -1.075000
-1.060000 -1.045000
-1.030000 -1.015000
-1.000000 -0.986667
-0.973333 -0.960000
-0.946667 -0.933333
-0.920000 -0.906667
-0.893333 -0.880000
-0.866667 -0.853333
-0.840000 -0.826667
-0.813333 -0.800000
-0.786667 -0.773333
-0.760000 -0.746667
-0.733333 -0.720000
-0.706667 -0.693333
-0.680000 -0.666667
-0.653333 -0.640000
-0.626667 -0.613333
-0.600000 -0.590000
-0.580000 -0.570000
-0.560000 -0.550000
-0.540000 -0.530000
-0.520000 -0.510000
-0.500000 -0.490000
-0.480000 -0.470000
-0.460000 -0.450000
-0.440000 -0.430000
-0.420000 -0.410000
-0.400000 -0.390000
-0.380000 -0.370000
-0.360000 -0.350000
-0.340000 -0.330000
-0.320000 -0.310000
-0.300000 -0.288889
-0.277778 -0.266667
-0.255556 -0.244444
-0.233333 -0.222222
-0.211111 -0.200000
-0.188889 -0.177778
-0.166667 -0.155556
-0.144444 -0.133333
-0.122222 -0.111111
-0.100000 -0.065517
-0.031034 0.000000
0.000000 0.002500
0.015000 0.170000
1.230000 NaN
NaN NaN