Project - Data Handling and Interpolation
Ans
%Vi file uploaded in MatLAB drive
Script
data= readmatrix("VI.xlsx"); %Data been read from VI file
V=data(:,1); % Data from 1st column & all rows been alloted to V variable;
I=data(:,2); % Data from 2nd column & all rows been alloted to V variable;
Vq=-17.3:0.1:0.9; % Variable assigned for the data provided for interpolation
Iq= interp1(V,I,Vq); %Interpolation command invoked with linear interpolation
Iq1= interp1(V,I,Vq,'spline'); %Interpolation command invoked with spline interpolation
figure(1);
plot(V,I,'o',Vq,Iq,':');grid;title('linear interpolation') %plotting of linear interpolation on figure 1
figure(2);
plot(V,I,'o',Vq,Iq1,'*');grid;title('spline interpolation') %plotting of spline interpolation on figure 2
%figure 1 line interpolation obtained
%figure 1 spline interpolation obtained

clear all
untitled4
filename=fopen("Iq1.txt","w"); %interpolation output been assigned to a txt file with name Iq1
fprintf(filename,'%f \t',Iq1); %f specifies the floating point number data type & \t provides the tab space between data in txt file
fclose(filename);
%interpolation data obatined & saed in txt file
%files saved in matlab drive