Challenge

Project - Data Handling and Interpolation

CODE

clc
clear all;
close all;
data= xlsread('VI.xlsx');
V= data(:,1);
I= data(:,2);
x= -17.3:0.1:0.9;
y= interp1(V,I,x)
plot(V,I,'*r',x,y,'-g');
xlabel('VOLTAGE (V)');
ylabel('CURRENT (I)');
fileID=fopen('project_2.txt','w');
fprintf(fileID,'%6.2f %12.8f\n',y);
fclose(fileID)

OUTPUT

y =

  Columns 1 through 11

  -28.0000  -26.0000  -24.0000  -19.0000  -16.5000  -14.0000  -12.3333  -10.6667   -9.0000   -8.4000   -7.8000

  Columns 12 through 22

   -7.2000   -6.6000   -6.0000   -5.8000   -5.6000   -5.4000   -5.2000   -5.0000   -4.8000   -4.6000   -4.4000

  Columns 23 through 33

   -4.2000   -4.0000   -3.9000   -3.8000   -3.7000   -3.6000   -3.5000   -3.4000   -3.3000   -3.2000   -3.1000

  Columns 34 through 44

   -3.0000   -2.9500   -2.9000   -2.8500   -2.8000   -2.7500   -2.7000   -2.6500   -2.6000   -2.5500   -2.5000

  Columns 45 through 55

   -2.4500   -2.4000   -2.3500   -2.3000   -2.2500   -2.2000   -2.1500   -2.1000   -2.0500   -2.0000   -1.9650

  Columns 56 through 66

   -1.9300   -1.8950   -1.8600   -1.8250   -1.7900   -1.7550   -1.7200   -1.6850   -1.6500   -1.6150   -1.5800

  Columns 67 through 77

   -1.5450   -1.5100   -1.4750   -1.4400   -1.4050   -1.3700   -1.3350   -1.3000   -1.2850   -1.2700   -1.2550

  Columns 78 through 88

   -1.2400   -1.2250   -1.2100   -1.1950   -1.1800   -1.1650   -1.1500   -1.1350   -1.1200   -1.1050   -1.0900

  Columns 89 through 99

   -1.0750   -1.0600   -1.0450   -1.0300   -1.0150   -1.0000   -0.9867   -0.9733   -0.9600   -0.9467   -0.9333

  Columns 100 through 110

   -0.9200   -0.9067   -0.8933   -0.8800   -0.8667   -0.8533   -0.8400   -0.8267   -0.8133   -0.8000   -0.7867

  Columns 111 through 121

   -0.7733   -0.7600   -0.7467   -0.7333   -0.7200   -0.7067   -0.6933   -0.6800   -0.6667   -0.6533   -0.6400

  Columns 122 through 132

   -0.6267   -0.6133   -0.6000   -0.5900   -0.5800   -0.5700   -0.5600   -0.5500   -0.5400   -0.5300   -0.5200

  Columns 133 through 143

   -0.5100   -0.5000   -0.4900   -0.4800   -0.4700   -0.4600   -0.4500   -0.4400   -0.4300   -0.4200   -0.4100

  Columns 144 through 154

   -0.4000   -0.3900   -0.3800   -0.3700   -0.3600   -0.3500   -0.3400   -0.3300   -0.3200   -0.3100   -0.3000

  Columns 155 through 165

   -0.2889   -0.2778   -0.2667   -0.2556   -0.2444   -0.2333   -0.2222   -0.2111   -0.2000   -0.1889   -0.1778

  Columns 166 through 176

   -0.1667   -0.1556   -0.1444   -0.1333   -0.1222   -0.1111   -0.1000   -0.0655   -0.0310         0         0

  Columns 177 through 183

    0.0025    0.0150    0.1700    1.2300       NaN       NaN       NaN


ans =

     0

TEXT FILE

-28.00 -26.00000000
-24.00 -19.00000000
-16.50 -14.00000000
-12.33 -10.66666667
 -9.00  -8.40000000
 -7.80  -7.20000000
 -6.60  -6.00000000
 -5.80  -5.60000000
 -5.40  -5.20000000
 -5.00  -4.80000000
 -4.60  -4.40000000
 -4.20  -4.00000000
 -3.90  -3.80000000
 -3.70  -3.60000000
 -3.50  -3.40000000
 -3.30  -3.20000000
 -3.10  -3.00000000
 -2.95  -2.90000000
 -2.85  -2.80000000
 -2.75  -2.70000000
 -2.65  -2.60000000
 -2.55  -2.50000000
 -2.45  -2.40000000
 -2.35  -2.30000000
 -2.25  -2.20000000
 -2.15  -2.10000000
 -2.05  -2.00000000
 -1.97  -1.93000000
 -1.89  -1.86000000
 -1.82  -1.79000000
 -1.76  -1.72000000
 -1.69  -1.65000000
 -1.62  -1.58000000
 -1.54  -1.51000000
 -1.48  -1.44000000
 -1.41  -1.37000000
 -1.34  -1.30000000
 -1.29  -1.27000000
 -1.25  -1.24000000
 -1.23  -1.21000000
 -1.20  -1.18000000
 -1.17  -1.15000000
 -1.14  -1.12000000
 -1.11  -1.09000000
 -1.07  -1.06000000
 -1.05  -1.03000000
 -1.01  -1.00000000
 -0.99  -0.97333333
 -0.96  -0.94666667
 -0.93  -0.92000000
 -0.91  -0.89333333
 -0.88  -0.86666667
 -0.85  -0.84000000
 -0.83  -0.81333333
 -0.80  -0.78666667
 -0.77  -0.76000000
 -0.75  -0.73333333
 -0.72  -0.70666667
 -0.69  -0.68000000
 -0.67  -0.65333333
 -0.64  -0.62666667
 -0.61  -0.60000000
 -0.59  -0.58000000
 -0.57  -0.56000000
 -0.55  -0.54000000
 -0.53  -0.52000000
 -0.51  -0.50000000
 -0.49  -0.48000000
 -0.47  -0.46000000
 -0.45  -0.44000000
 -0.43  -0.42000000
 -0.41  -0.40000000
 -0.39  -0.38000000
 -0.37  -0.36000000
 -0.35  -0.34000000
 -0.33  -0.32000000
 -0.31  -0.30000000
 -0.29  -0.27777778
 -0.27  -0.25555556
 -0.24  -0.23333333
 -0.22  -0.21111111
 -0.20  -0.18888889
 -0.18  -0.16666667
 -0.16  -0.14444444
 -0.13  -0.12222222
 -0.11  -0.10000000
 -0.07  -0.03103448
  0.00   0.00000000
  0.00   0.01500000
  0.17   1.23000000
   NaN          NaN
   NaN 
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.