Project - Data Handling and Interpolation
QUESTION :
Project :
In a laboratory experiment, data of voltage and current has been recorded and the same is attached in an excel file ( Click on this link VI.xlsx ). 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.
Key Highlights:
- Graphical solutions are more visual and appealing
- Interpolation of data
- Read excel file
- Write to text file
Deliverables:
- Find missing data and save it in text
- Interpolate the data set
- Save your program and attach the same.
- Save txt file and upload in attachment
ANSWER :
PROGRAM :
clc; %clear the command window
clear all; % clear the workspace
% Here V = voltage ; I = current ; IV = interpolation voltage ; II =
% interpolation current
d = readmatrix('VI.xlsx'); % call the excel file from MATLAB
V = d(:,1); % d value assign V
I = d(:,2); % d value assign T
X = -17.3:0.1:0.9; % defining range for interpolation
Y = interp1(V,I,X); % Y value get from using interpolation command
plot(V,I,'r--',X,Y,'g'); % plot
IV = [-17.2 -13 -11 -9 -6 -1 0.11 0.25 0.5 0.61 0.66]; % interpolation voltage value
II = interp1(V,I,IV); % II value get from using interpolation command
Z = [IV,II]; % Z value get from interpoation voltage and interpolation current
xlabel('V(volt)'); % x label
ylabel('I(mAmp)'); % y label
title('COMPLETE CURVE AFTER AFTER INTERPOLATION'); % title
legend('VI DATA POINTS','MISSING DATA POINTS');
fileID = fopen('my project.txt','w'); % write and save text file
fprintf(fileID,'%5s %10s\n','V(volt)','I(mAmp)'); % print
fprintf(fileID,'%f %f\n',Z); % print
fclose(fileID); % close the file
ANSWER :
After interpolation of data value below on. this data file saved in text file.
V(volt) I(mAmp)
-17.200000 -13.000000
-11.000000 -9.000000
-6.000000 -1.000000
0.110000 0.250000
0.500000 0.610000
0.660000 -26.000000
-2.500000 -1.650000
-1.150000 -0.733333
-0.188889 0.000000
0.000000 0.170000
1.610000 NaN
RESULT :


