Project - Data Handling and Interpolation
1.
clc % Clear Command Window
clear
close all %close all hidden closes all figures,
% including figures with hidden handles.
a = readmatrix("VI .xlsx"); %to read the VI.xlsx file
x = a(:,1); %define voltage column
y = a(:,2); %define current column
b = -17.3:0.1:0.9; %setting the range
A = interp1(x,y,b) %using interpolation command
A1 = fillmissing(A,"previous") %used to fill missing interpolated data
plot(b,A) %used to plot interpolated data
xlabel('voltage (V)') %labelling X-axis & Y-axis
ylabel('Current (I)')
title('current vs voltage graph') % to titling the graph
grid on %used to on the grid
fileid =fopen('Interpolation.txt','w'); %to save the interpolated data in a txt file
fprintf(fileid,'%f \n',A1);
fclose(fileid);