Project - Data Handling and Interpolation
%1
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.
clc;
clear all;
%Read excel file
my = readmatrix('VI.xlsx');
x = my(:,1);
y = my(:,2);
%Interpolation of data
xq = -17.3:0.1:0.9;
k = interp1(x,y,xq);
plot(x,y,'b +',xq,k,'g--');
xlabel('voltage');
ylabel('current');
legend ('data points provided','missing data points');
title('voltage vs current');
%saving text file
fileID = fopen('project.txt','w');
fprinttf(fileID,'%8S %10S\N','V(VOLT)','I(mAMP)');
fprinttf(fileID,'%\f %f\n',K);
fclose(fileID);