Project - Data Handling and Interpolation
Project - Data Handling and Interpolation
Aim:
In this project, we are going to read the excel file into the MATLAB program as well as perform the interpolation in the given range of -17.3:0.1:0.9, finally generate the interactive plot for the interpolated data and store them in a text file.
Matlab Code:
data= xlsread('VI.xlsx');
V=data(:,1);
I=data(:,2);
x=-17.3:0.1:0.9;
ya1=interp1(V,I,x);
ya2=interp1(V,I,x,'spline');
figure(1)
plot(V,I,'o',x,ya1,': .');
title('Linear Interpolation');
xlabel('Voltage(V)');
ylabel('Current(I)');
legend('Actual Value','Interpolated Value');
grid;
figure(2)
plot(V,I,'s',x,ya2,'b: .');
title('Spline Interpolation');
xlabel('Voltage(V)');
ylabel('Current(I)');
legend('Actual Value','Interpolated Value');
grid;
output=fopen('VOLTAGE AND CURRENT_result.txt','w');
fprintf(output,'Voltage Current\n');
fprintf(output,'%3.3f %4.3f\n',x,ya2);
fclose(output);
Full View Window:


Comments:


Output:

VOLTAGE AND CURRENT_result

Linear Interpolation

Spline Interpolation