Challenge

Project - Data Handling and Interpolation

Objective: To read the excel file in the Matlab program and perform the interpolation in the range of -17.3:0.1:0.9. Generate the interactive plot for the interpolated data and store them in a text file

a=xlsread('VI.xlsx'); % To read the excel file
v= a(:, 1); % To populate the voltage values
i= a(:, 2); % To populate the Current Values
v1 = [-17.3:0.1:0.9]; %To set the limit
i1= interp1(v,i,v1); % Using the interpolation function for Linear Interpolation
i2= interp1(v,i,v1,'spline'); % Using the interpolation function for Spline Interpolation
figure(1);
plot(v,i,'g--',v1,i1,'b*');
grid;
xlabel('V(Volt)'); % To label the x-axis
ylabel('I(mAmp)') % To label the y-axis
title('Linear Interpolation');
figure(2);
plot(v,i,'g--',v1,i2,'b*');
grid;
xlabel('V(Volt)');
ylabel('I(mAmp)')
title('Spline Interpolation');
filename=fopen('Interpolation_project.txt','w'); % To write the file in text.
fprintf (filename,'%d/n',i1,i2);
fclose(filename);

i1 =

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

i2 =

Columns 1 through 11

-28.0000 -28.1734 -24.0000 -19.0000 -15.8685 -14.0000 -12.2353 -10.5022 -9.0000 -7.8806 -7.1062

Columns 12 through 22

-6.5915 -6.2512 -6.0000 -5.7670 -5.5389 -5.3164 -5.1007 -4.8926 -4.6931 -4.5031 -4.3236

Columns 23 through 33

-4.1556 -4.0000 -3.8574 -3.7271 -3.6080 -3.4991 -3.3993 -3.3076 -3.2228 -3.1440 -3.0701

Columns 34 through 44

-3.0000 -2.9328 -2.8682 -2.8061 -2.7464 -2.6889 -2.6334 -2.5799 -2.5282 -2.4782 -2.4298

Columns 45 through 55

-2.3827 -2.3369 -2.2922 -2.2486 -2.2058 -2.1637 -2.1222 -2.0812 -2.0405 -2.0000 -1.9596

Columns 56 through 66

-1.9193 -1.8792 -1.8394 -1.7999 -1.7608 -1.7223 -1.6843 -1.6469 -1.6103 -1.5745 -1.5395

Columns 67 through 77

-1.5055 -1.4725 -1.4406 -1.4099 -1.3804 -1.3522 -1.3253 -1.3000 -1.2762 -1.2538 -1.2327

Columns 78 through 88

-1.2130 -1.1944 -1.1770 -1.1605 -1.1450 -1.1304 -1.1164 -1.1032 -1.0906 -1.0784 -1.0667

Columns 89 through 99

-1.0552 -1.0441 -1.0330 -1.0221 -1.0111 -1.0000 -0.9887 -0.9773 -0.9656 -0.9538 -0.9418

Columns 100 through 110

-0.9297 -0.9174 -0.9049 -0.8923 -0.8795 -0.8665 -0.8535 -0.8403 -0.8269 -0.8135 -0.7999

Columns 111 through 121

-0.7862 -0.7724 -0.7585 -0.7445 -0.7304 -0.7162 -0.7019 -0.6876 -0.6731 -0.6586 -0.6441

Columns 122 through 132

-0.6294 -0.6147 -0.6000 -0.5852 -0.5704 -0.5557 -0.5409 -0.5263 -0.5119 -0.4976 -0.4835

Columns 133 through 143

-0.4696 -0.4561 -0.4428 -0.4299 -0.4174 -0.4054 -0.3937 -0.3826 -0.3721 -0.3621 -0.3527

Columns 144 through 154

-0.3439 -0.3359 -0.3285 -0.3219 -0.3161 -0.3112 -0.3070 -0.3038 -0.3016 -0.3003 -0.3000

Columns 155 through 165

-0.3007 -0.3021 -0.3037 -0.3052 -0.3062 -0.3064 -0.3053 -0.3026 -0.2978 -0.2906 -0.2806

Columns 166 through 176

-0.2674 -0.2507 -0.2300 -0.2050 -0.1752 -0.1404 -0.1000 -0.0559 -0.0182 0.0007 -0.0002

Columns 177 through 183

0.0002 0.0129 0.1700 1.2300 10.0433 39.0701 101.1102

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.