Challenge

Project - Data Handling and Interpolation

Program-

read=xlsread('VI.xlsx');%import and read excelfile
format compact
V=read(:,1); %read first column of excel file
I=read(:,2); %read second column of excel file
 
Xq = -17.3:0.1:0.9 ; %define interpolation range
Yq1 = interp1(V,I,Xq); % interpolate V,I
Yq2=interp1(V,I,Xq,'spline'); % interpolate V,I by spline method
VV =[-17.2,-17.1,-13.8,-13.5,-13.0,-12.5,-11,-9,-5.76,-6,-1,0.11,0.25,0.5,0.61];
zq=interp1(V,I,VV);%interpolate v,I & VV
%ploting curve for (V,I), curve for V,I interpolation & curve for V,I by spline method
subplot(2,2,1);
plot(V,I,'o','LineWidth',2);
grid on
axis([-18 2 -30 5])
axis([-18 2 -30 5])
xlabel('voltage');
ylabel('Current');
title('V vs I data')
subplot(2,2,2);
plot(V,I,'o',Xq,Yq1,'r','LineWidth',2);
grid on
axis([-18 2 -30 5])
xlabel('voltage');
ylabel('Current');
title('V vs I Linear Interpolation')
subplot(2,2,3);
plot(V,I,'o',Xq,Yq2,'g','LineWidth',2);
grid on
axis([-18 2 -30 5])
xlabel('voltage');
ylabel('Current');
title('V vs I Spline Interpolation')
%compute the current from the given voltage data And store it in the text File
f = fopen('voltageCurrentData.txt','w');
fprintf(f,'computing the values from given data\n');
fprintf(f,'Voltage\t Current \n');
for i=1:length(VV)
fprintf(f,'%.4f \t %0.4f\n ',VV(i),zq(i));
end
fclose(f);
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.