Challenge

Project - Data Handling and Interpolation

AIM: To find the missing values of voltage with respect to the current.

CODE:

% Data from V and I is not taking directly from the...
% excel sheet.Therefore giving V and I as input from ...
% userside manually.
% Voltage Range Given,
V =[
-17.3
-17.1
-17
-16.8
-16.5
-16
-15
-14
-12
-10
-8
-5
-2
-0.2
0.09
0.19
0.27
0.39
0.43
0.5
0.55
0.6
0.62
0.65
];
% Current(I) Range Given,
I = [-28
-24
-19
-14
-9
-6
-4
-3
-2
-1.3
-1
-0.6
-0.3
-0.1
0
0
0
0.01
0.03
0.17
0.42
1.23
1.99
3.91 ];
%The range within the interpolation should made
R=[-17.3:0.1:0.9];
% V vs. I plot
IV=interp1(V,I,R);
plot(V,I,'o',R,IV)
grid on;
xlabel('Voltage(V)','Fontsize',10)
ylabel('Current(I)','Fontsize',10)
title('Interpolated Data of V vs. I','Fontsize',12)
legend('Given Data','Missing Data')
fileID=fopen('prowk4.txt','W');
fprintf(fileID,'%8s %13s\n','volt','current');
fprintf(fileID,'%f %f\n',IV);
fclose(fileID)
PLOT:
MISSING VALUES CORRESPONDENT TO VOLTAGE & CURRENT:
volt current
-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
LINK OF TEXT FILE: The text file is attached below.
PROGRAM WITH PLOT:
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.