Challenge

Project - Data Handling and Interpolation

Aim:

  • Handling and Interpolating the Data

Objective :

  • read the laboratory experimented data from the excel file.
  • extract the data and store it in variables.
  • Then interpolate them.
  • Compute the current from the given voltage data.
  • Store this computed data in the text file.

project_fileHandling.m file :

%% reading data from excel 
FileId = xlsread('VI.xlsx');
V = FileId(:,1);
I = FileId(:,2);

%% interpolation linear 
Vq = -17.3:0.1:0.9 ;
Iq = interp1(V,I,Vq);

%% spline method Iq2
Iq2 = interp1(V,I,Vq,'spline');

%% computing current(Iq3) for the given VV voltage data
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];
Iq3 = interp1(V,I,VV);

%% plotted the V Vs I
subplot(2,2,1);
plot(V,I,'o','LineWidth',2);
grid on 
axis([-18 2 -30 5])
xlabel('voltage V Volt');
ylabel('Current I Ampere');
title('V vs I data')
subplot(2,2,2);
plot(V,I,'o',Vq,Iq,'r','LineWidth',2);
grid on 
axis([-18 2 -30 5])
xlabel('voltage V Volt');
ylabel('Current I Ampere');
title('V vs I Linear Interpolation')
subplot(2,2,3);
plot(V,I,'o',Vq,Iq2,'g','LineWidth',2);
grid on 
axis([-18 2 -30 5])
xlabel('voltage V Volt');
ylabel('Current I Ampere');
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 current from given voltage data\n');
fprintf(f,'Voltage\t Current \n');
for i=1:length(VV)
    fprintf(f,'%.4f \t %0.4f\n ',VV(i),Iq3(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.