Project - Data Handling and Interpolation
clc
clear all
file=xlsread('VI.xlsx')
format compact;
V=file(:,1)
I=file(:,2)
x=-17.3:0.1:0.9;
y=interp1(V,I,x,'spline');
subplot(211);
plot(V,I,'r',x,y)
grid on
title('voltag vs current')
xlabel('voltage')
ylabel('current')
grid on
VV=[ -17.3000
-17.1000
-17.0000
-16.8000
-16.5000
-16.0000
-15.0000
-14.0000
-12.0000
-10.0000
-8.0000
-5.0000
-2.0000
-0.2000
0.0900
0.1900
0.2700
0.3900
0.4300
0.5000
0.5500
0.6000
0.6200
0.6500]
II=interp1(V,I,VV)
z=[VV II]
fileID = fopen('VVII.txt','w');
fprintf(fileID,'%6s %12s\n','VV','II');
fprintf(fileID,'%6,2f %12.8+\n',z);
fclose=fileID
comments
%clc is used to clear in the editor window
%clear all is used to clear all in the workspace
file=xlsread('VI.xlsx') - is used to read the excel file
V=file(:,1) I=file(:,2)- is used for voltag and current columns
y=interp1(V,I,x,'spline');- is used for interpolation spline is used for sereis of polynomial
title('voltag vs current') - is used for title the graph
xlabel('voltage') - is used for xlabel in the graph
ylabel('current') - is used for ylabel in the graph
fileID = fopen('VVII.txt','w'); is used for write
fprintf(fileID,'%6s %12s\n','VV','II');- is used for the file id
fprintf(fileID,'%6,2f %12.8+\n',z);- is used to print the file
fclose=fileID- useed to clos the file