Project - Data Handling and Interpolation
AIM:
In this project, we are reading the excel file into the MATLAB program.
perform the interpolation in the range of -17.3:0.1:0.9
Matlab Code :
close all
clear;
clc;
D=xlsread('VI'); % VI Data in Excel
v=D(:,1);
i=D(:,2);
xq=[-17.3:0.1:0.9];
yq1=interp1(v,i,xq);
yq2=interp1(v,i,xq,'spline');
figure(1) % Seprate image Spline
plot(v,i,'s',xq,yq1,': .');
title('Linear Interpolation');
xlabel('Voltage (V)');
ylabel('Current (I)');
legend('Actual Value', 'Interpolated value', 'location','Northeast');
grid on;
figure(2) % Sperate image of Linear interpolation
plot(v,i,'s',xq,yq2,'b: .');
title('SPLINE INTERPOLATION');
xlabel('Voltage (V)');
ylabel('Current (I)');
legend('Actual Value', 'Interpolated value', 'location','Northeast');
grid minor; % Minor Grid
vol_cu=fopen('VI_output.txt','w');
fprintf(vol_cu,' Voltage Current\n');
fprintf(vol_cu,'%4.3f %5.3f\n',xq,yq2);
fclose(vol_cu);
