Project - Data Handling and Interpolation
ANSWERS:
a = readmatrix('VI (2).xlsx')
V= a(:,1);
I = a(:,2);
X = -17.3:0.1:0.9;
k1 =interp1(V,I,X,"linear");
k2=interp1(V,I,X,"spline");
figure(1)
plot(V,I)
xlabel('Voltage')
ylabel('Current')
legend('Original Graph')
grid on
figure(2)
plot(X,k1,'o')
xlabel('Voltage')
ylabel('Current')
legend('Linear Interpolation')
grid on
figure(3)
plot(X,k2)
xlabel('Voltage')
ylabel('Current')
legend('Spline Interpolation')
grid on
z=[X;k1;k2];
writematrix(z,'Interpolation.txt')
FINALA_PROJECT
a =
-17.3000 -28.0000
-17.1000 -24.0000
-17.0000 -19.0000
-16.8000 -14.0000
-16.5000 -9.0000
-16.0000 -6.0000
-15.0000 -4.0000
-14.0000 -3.0000
-12.0000 -2.0000
-10.0000 -1.3000
-8.0000 -1.0000
-5.0000 -0.6000
-2.0000 -0.3000
-0.2000 -0.1000
0.0900 0
0.1900 0
0.2700 0
0.3900 0.0100
0.4300 0.0300
0.5000 0.1700
0.5500 0.4200
0.6000 1.2300
0.6200 1.9900
0.6500 3.9100
in txt interpolation
-17.3,-17.2,-17.1,-17,-16.9,-16.8,-16.7,-16.6,-16.5,-16.4,-16.3,-16.2,-16.1,-16,-15.9,-15.8,-15.7,-15.6,-15.5,-15.4,-15.3,-15.2,-15.1,-15,-14.9,-14.8,-14.7,-14.6,-14.5,-14.4,-14.3,-14.2,-14.1,-14,-13.9,-13.8,-13.7,-13.6,-13.5,-13.4,-13.3,-13.2,-13.1,-13,-12.9,-12.8,-12.7,-12.6,-12.5,-12.4,-12.3,-12.2,-12.1,-12,-11.9,-11.8,-11.7,-11.6,-11.5,-11.4,-11.3,-11.2,-11.1,-11,-10.9,-10.8,-10.7,-10.6,-10.5,-10.4,-10.3,-10.2,-10.1,-10,-9.9,-9.8,-9.7,-9.6,-9.5,-9.4,-9.3,-9.2,-9.1,-9,-8.9,-8.8,-8.7,-8.6,-8.5,-8.4,-8.3,-8.2,-8.1,-8,-7.9,-7.8,-7.7,-7.6,-7.5,-7.4,-7.3,-7.2,-7.1,-7,-6.9,-6.8,-6.7,-6.6,-6.5,-6.4,-6.3,-6.2,-6.1,-6,-5.9,-5.8,-5.7,-5.6,-5.5,-5.4,-5.3,-5.2,-5.1,-5,-4.9,-4.8,-4.7,-4.6,-4.5,-4.4,-4.3,-4.2,-4.1,-4,-3.9,-3.8,-3.7,-3.6,-3.5,-3.4,-3.3,-3.2,-3.1,-3,-2.9,-2.8,-2.7,-2.6,-2.5,-2.4,-2.3,-2.2,-2.1,-2,-1.9,-1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,-1,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9
-28,-26,-24,-19,-16.5,-14,-12.3333333333333,-10.6666666666667,-9,-8.40000000000001,-7.8,-7.2,-6.60000000000001,-6,-5.8,-5.6,-5.4,-5.2,-5,-4.8,-4.6,-4.4,-4.2,-4,-3.9,-3.8,-3.7,-3.6,-3.5,-3.4,-3.3,-3.2,-3.1,-3,-2.95,-2.9,-2.85,-2.8,-2.75,-2.7,-2.65,-2.6,-2.55,-2.5,-2.45,-2.4,-2.35,-2.3,-2.25,-2.2,-2.15,-2.1,-2.05,-2,-1.965,-1.93,-1.895,-1.86,-1.825,-1.79,-1.755,-1.72,-1.685,-1.65,-1.615,-1.58,-1.545,-1.51,-1.475,-1.44,-1.405,-1.37,-1.335,-1.3,-1.285,-1.27,-1.255,-1.24,-1.225,-1.21,-1.195,-1.18,-1.165,-1.15,-1.135,-1.12,-1.105,-1.09,-1.075,-1.06,-1.045,-1.03,-1.015,-1,-0.986666666666667,-0.973333333333333,-0.96,-0.946666666666667,-0.933333333333333,-0.92,-0.906666666666667,-0.893333333333333,-0.88,-0.866666666666667,-0.853333333333333,-0.84,-0.826666666666667,-0.813333333333333,-0.8,-0.786666666666667,-0.773333333333333,-0.76,-0.746666666666667,-0.733333333333333,-0.72,-0.706666666666667,-0.693333333333333,-0.68,-0.666666666666667,-0.653333333333333,-0.64,-0.626666666666667,-0.613333333333333,-0.6,-0.59,-0.58,-0.57,-0.56,-0.55,-0.54,-0.53,-0.52,-0.51,-0.5,-0.49,-0.48,-0.47,-0.46,-0.45,-0.44,-0.43,-0.42,-0.41,-0.4,-0.39,-0.38,-0.37,-0.36,-0.35,-0.34,-0.33,-0.32,-0.31,-0.3,-0.288888888888889,-0.277777777777778,-0.266666666666667,-0.255555555555556,-0.244444444444445,-0.233333333333333,-0.222222222222222,-0.211111111111111,-0.2,-0.188888888888889,-0.177777777777778,-0.166666666666667,-0.155555555555556,-0.144444444444444,-0.133333333333333,-0.122222222222222,-0.111111111111111,-0.1,-0.0655172413793104,-0.0310344827586207,0,0,0.00249999999999999,0.015,0.17,1.23,NaN,NaN,NaN
-28,-28.1734256447144,-24,-19,-15.8685294950185,-14,-12.2353372836135,-10.5022164647839,-9,-7.88060899403963,-7.10619914483659,-6.59148479861374,-6.25118030159395,-6,-5.76703105615325,-5.53885189676899,-5.31641376466102,-5.10066790264313,-4.89256555352912,-4.69305796013278,-4.5030963652679,-4.32363201174828,-4.15561614238772,-4,-3.85739973042026,-3.72709109156898,-3.60801474438795,-3.499111349819,-3.39932156880392,-3.30758606228453,-3.22284549120263,-3.14404051650004,-3.07011179911856,-3,-2.93279978824827,-2.86822186561566,-2.80613094201655,-2.74639172736534,-2.6888689315764,-2.63342726456414,-2.57993143624294,-2.52824615652718,-2.47823613533125,-2.42976608256955,-2.38270070815645,-2.33690472200636,-2.29224283403364,-2.2485797541527,-2.20578019227792,-2.16370885832369,-2.12223046220439,-2.08120971383442,-2.04051132312816,-2,-1.9595753654897,-1.91927668513854,-1.87917813561314,-1.83935389358016,-1.79987813570623,-1.76082503865799,-1.72226877910209,-1.68428353370518,-1.64694347913388,-1.61032279205484,-1.57449564913471,-1.53953622704012,-1.50551870243771,-1.47251725199414,-1.44060605237603,-1.40985928025004,-1.3803511122828,-1.35215572514095,-1.32534729549114,-1.3,-1.27616124979292,-1.2537713938302,-1.23274401553089,-1.21299269831404,-1.19443102559869,-1.17697258080389,-1.16053094734868,-1.14501970865212,-1.13035244813324,-1.11644274921109,-1.10320419530472,-1.09055036983318,-1.0783948562155,-1.06665123787074,-1.05523309821794,-1.04405402067616,-1.03302758866442,-1.02206738560179,-1.0110869949073,-1,-0.988735199374782,-0.977282251829893,-0.965646031239426,-0.953831411477472,-0.941843266418124,-0.929686469935473,-0.917365895903612,-0.904886418196631,-0.892252910688623,-0.879470247253681,-0.866543301765895,-0.853476948099358,-0.840276060128162,-0.826945511726398,-0.813490176768159,-0.799914929127536,-0.786224642678622,-0.772424191295507,-0.758518448852285,-0.744512289223046,-0.730410586281884,-0.716218213902889,-0.701940045960154,-0.687580956327771,-0.673145818879831,-0.658639507490426,-0.644066896033649,-0.629432858383591,-0.614742268414344,-0.6,-0.585216190870722,-0.570422034180953,-0.55565398694121,-0.540948506162007,-0.52634204885386,-0.511871072027283,-0.497572032692792,-0.483481387860902,-0.469635594542128,-0.456071109746986,-0.442824390485989,-0.429931893769654,-0.417430076608496,-0.405355396013029,-0.39374430899377,-0.382633272561232,-0.372058743725932,-0.362057179498384,-0.352665036889103,-0.343918772908605,-0.335854844567405,-0.328509708876017,-0.321919822844958,-0.316121643484742,-0.311151627805884,-0.3070462328189,-0.303841915534304,-0.301575132962612,-0.300282342114339,-0.3,-0.300694387778356,-0.302051083201149,-0.303685488168369,-0.305213004580003,-0.30624903433604,-0.30640897933647,-0.305308241481279,-0.302562222670458,-0.297786324803993,-0.290595949781875,-0.280606499504091,-0.26743337587063,-0.25069198078148,-0.22999771613663,-0.204965983836069,-0.175212185779784,-0.140351723867765,-0.1,-0.0558891664937565,-0.0182183773354182,0.000704958683086859,-0.000161665906564869,0.000228251413584533,0.0128524579834356,0.17,1.23,10.0433375615302,39.0700570806576,101.110221980335