Project - Data Handling and Interpolation
A=xlsread('VI.xlsx') - given xlxs to read the data from xlsx file.
V=A(:,1) - select the column 1 data in xlsx file.
I=A(:,2) -select the column 2 dta in xlsx file.
V1=-17.3:0.1:0.9 - Voltage in given in project .
I1=interp1(V,I,V1,"spline") - using the interp1 to calculate current given voltage is V1;
figure(1) - plot figure 1 to plot value in figure 1
subplot(121) - use sub plot command to ploting.
plot(V,I,'-o','linewidth',2,'color','r') - plot V vs I graph.
grid - to use grid on to leabeling the plot.
title('VIData') - give the title.
xlabel('V(Volt') - set the label in xaxis.
ylabel('I(mAmp)') - set the label in yaxis.
axis([-25 5 -30 5]) - set the axis limits.
subplot(122)
plot(V1,I1,'linewidth',2) - plot the the new voltage data to given in the project .
grid
xlabel('V(volt)') - set the label in xaxis.
ylabel('I(mAmp)') - set the label in yaxis.
title('Interpolation data') - set the title.
axis([-25 5 -30 5]) - set the axis limits.
figure(2)
plot(V,I,'d',V1,I1,'linewidth',2) - plot the value.
grid
legend('Experiment Value calculated by Interpolation') - to set the legend .
title('Voltage(v)-Current(I)')-set the title.
xlabel('V(volt)') - label xaxis.
ylabel('I(mAmp)') - leabel Yaxis.
VV=[-17.2 -17.1 -13.8 -13.5 -13.0 -12.5 -11 -9 -5.76 -6 -10.11 0.25 0.5 0.61] - given voltage data in program.
I2=interp1(V,I,VV,"spline") - using the interp1 to calculate current given voltage.
figure(3)
plot(VV,I2,'O--','linewidth',2,'color','g') - plot the value.
grid
xlabel('V(volt)') - set the label in xaxis.
ylabel('I(mAmp)') - set the label in yaxis.
title('Volt Current Value I vs given Volatge V') - set the title.
fid=fopen('Voltage_Current.txt','w') - oepn txt file.
fprintf(fid,'V(Volt)I(mAmp)n') - storing the value in file.
fprintf(fid,'%d%f\n',VV,I2) - storing the value in file.
fclose(fid) - close output file.
A=xlsread('VI.xlsx');%to read the data from xlsx file.
V=A(:,1);%select the column 1 data in xlsx file.
I=A(:,2);%select the column 2 dta in xlsx file.
V1=-17.3:0.1:0.9;%Voltage in given in project .
I1=interp1(V,I,V1,"spline");%using the interp1 to calculate current given voltage is V1;
figure(1);
subplot(121);%use sub plot command to ploting.
plot(V,I,'-o','linewidth',2,'color','r');%plot V vs I graph.
grid;
title('VIData');%give the title.
xlabel('V(Volt');%set the label in xaxis.
ylabel('I(mAmp)');% set the label in yaxis.
axis([-25 5 -30 5]);%set the axis limits.
subplot(122)
plot(V1,I1,'linewidth',2);%plot the the new voltage data to given in the project .
grid;
xlabel('V(volt)');%set the label in xaxis.
ylabel('I(mAmp)');% set the label in yaxis.
title('Interpolation data');%set the title.
axis([-25 5 -30 5]);%set the axis limits.
figure(2);
plot(V,I,'d',V1,I1,'linewidth',2);%plot the value.
grid;
legend('Experiment Value calculated by Interpolation');
title('Voltage(v)-Current(I)');%set the title.
xlabel('V(volt)');%label xaxis.
ylabel('I(mAmp)');%leabel Yaxis.
VV=[-17.2 -17.1 -13.8 -13.5 -13.0 -12.5 -11 -9 -5.76 -6 -10.11 0.25 0.5 0.61];%given voltage data in program.
I2=interp1(V,I,VV,"spline");%using the interp1 to calculate current given voltage.
figure(3);
plot(VV,I2,'O--','linewidth',2,'color','g');%plot the value.
grid;
xlabel('V(volt)');%set the label in xaxis.
ylabel('I(mAmp)');% set the label in yaxis.
title('Volt Current Value I vs given Volatge V');%set the title.
fid=fopen('Voltage_Current.txt','w');%oepn txt file.
fprintf(fid,'V(Volt)I(mAmp)n');%storing the value in file.
fprintf(fid,'%d%f\n',VV,I2);%storing the value in file.
fclose(fid);%close output file.





