Challenge

Project - Data Handling and Interpolation

Project - Data Handling and Interpolation:

In a laboratory experiment, data of voltage and current has been recorded and the same is attached in an excel file. we get the file for read it and collect the data for voltage and current, we do analysis with interpolation in the range of -17.3:0.1:0.9 are perfromance. collecting the data in text file. we find the missing data and collect the data in text file, save it in text file.

Script Code:

clear all
%% V(Voltage) vs I(Current)
A=xlsread('VI.xlsx')                   %% read the xlsx file here
V=A(:,1);                                  %% Column A is allocated for Voltage
I=A(:,2);                                   %% A(row,col) COLUMN B for CURRENT
V1=[-17.3:0.1:0.9];                   %%interpolation range are set here
Ib1=interp1(V,I,V1);                   %%linear interpolation are done
Ib2=interp1(V,I,V1,'spline');         %%spline interpolation
figure(1)
plot(V,I,'o',V1,Ib1,':.')                   %% plot for linear interpolation
grid
title('linear interpolation')
figure(2)
plot(V,I,'o',V1,Ib2,':.')                    %% plot for spline interpolation
grid
title('spline interpolation')
VV =[-17.2 -17.1 -13.8 -13.5 -13.0 -12.5 -11 -9 -5.76 -6 -1 0.11 0.25 0.5 0.61] %% new voltage range are kept here
I2=interp1(V,I,VV)                         %%linear interpolation for find value of current
figure(3)
plot(VV,I2,'o--')                              %% plot linear interpolation for new voltage and current value
grid
VVI2=[VV;I2]                                                 %% save value in matrix
fid=fopen('Voltage_and_current.txt','w')            %% Write to text file
fprintf(fid,'%6s %12s\n','Voltage','Current');      %% title for voltage and current
fprintf(fid,'%6.2f %12.8f\n',VVI2);                    %% save data for voltage and current
fclose(fid);
 
Text File Result:
 
Voltage              Current
-17.20          -26.00000000
-17.10          -24.00000000
-13.80          -2.90000000
-13.50          -2.75000000
-13.00          -2.50000000
-12.50          -2.25000000
-11.00          -1.65000000
-9.00            -1.15000000
-5.76            -0.70133333
-6.00            -0.73333333
-1.00            -0.18888889
0.11               0.00000000
0.25               0.00000000
0.50               0.17000000
0.61               1.61000000
 
Screen Images:
 
 
 
 
Figure 1:
Figure 2:
Figure 3:
 
 
Result Image:
 
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.