Project - Data Handling and Interpolation
Solution to the Project :
data = xlsread('VI.xlsx'); % Given excel sheet data is read into MATLAB
V = data(:,1); I = data(:,2); % To find the interpolated data the Voltage and Current values are saved into two vectors
Vq = [-17.3:0.1:0.9]; % Defined interval for interpolation
x = interp1(V,I,Vq,'spline'); % One-Dimentional Interpolation is used here with spline method
% Interpolated data and actual data is plotted used below code
plot(V,I,'o',Vq,x,':.')
xlabel('Voltage in Volts (V)');
ylabel ('Current in Amperes (A)');
title ('V vs I graph');
legend ('Actual Data','Interpolated Data');
grid;
% The interpolated data is saved into text data using below code
fid = fopen ('Interpolated data.txt','w');
len = length (Vq);
for i = 1:len
fprintf (fid, '%d\n %d\t',Vq(:,i), x(:,i));
end
fclose(fid);