Project - Data Handling and Interpolation
Coding for Interpolation :
[data,title] = xlsread('VI.xlsx'); %Loading data from excel
V=data(:,1); %Assigning first column of data to voltage
I=data(:,2); %Assigning second column of data to current
inter=[-17.3:0.1:0.9]; %Defining interpolation period
x=interp1(V,I,inter); %Interpolation
plot(V,I,'b-',inter,x,'r:');
grid;
legend('Actual plot','Interpolated plot');
save('Interdata.txt','x'); %saving interpolated data as text
Output :

Missing data in text file :
When saving text file using save command, data is not saved in proper format as ahown :

Coding for saving data as text file :
Solution 1 :
load('X.mat'); %loading interpolated data
dlmwrite('InterpolatedData.txt', x, 'delimiter','\t')
%Saving interpolated data as text file
Output :

Solution 2 :
fid=fopen('fdata.txt','w'); %saving data using file operations
for i=1:length(x)
fprintf(fid,'%d\n',x(i));
end
fclose(fid); %Closing the file
Output :
