Project - Data Handling and Interpolation
Project Answer.
% using this command to read the excel file 'VI' as given in question.
File_Excel=xlsread('VI.xlsx');
% Reading Voltage 'V' from the extracted excel file
V=File_Excel(:,1);
% Reading Current 'I' from the extracted excel file
I=File_Excel(:,2);
% defining a variable x in the range given in question for interpolation
x=[-17.3:0.1:0.9];
% using 'interpl' command for Linear interpolation between V and I for the
% given range of x
y=interp1(V,I,x,'linear');
% Plotting for the variable V, I, x, y in red with + sign
plot(V,I,x,y,'r+');
% holdind and griding the plot
hold; grid;
% title of the plot
title('Voltage vs Current')
% creating a text file to save interpolated data
Interpolated_data=fopen('x_y_interpolated_value.txt','w');
% defining a variable n for the length of x
n=length(x);
% creating a for loop for saving the data into text file
for i=1:n,
% using fprintf command to store data into text file
fprintf(Interpolated_data, '%f \t %f \n', x(i),y(i));
% closing the for loop
end
% closing the text file with stored interpolated data
fclose(Interpolated_data);
