Challenge

Project - Data Handling and Interpolation

% interpolating the given data from excel file

% reading the excel file

VI=xlsread('VI.xlsx');

% defining 'V' from the excel file

V=VI(:,1);

% defining 'I' from the excel file

I=VI(:,2);

% defining 'X' which is the range to interpolate

X=[-17.3:0.1:0.9];

% performing interpolation

Y=interp1(V,I,X);

% plotting the interpolated data

plot(V,I,'ob',X,Y,'Markerfacecolor','r','linewidth',3);

% finding current values for the corresponding voltages

% opening and writing the excel file from the system

fileid1=fopen('C:\Users\user\Documents\MATLAB\VI.xlsx'.'r')

% writing output to the text file

fileid=fopen('C:\Users\user\Documents\MATLAB\project.txt','w');

% defining 'VV' given in the problem

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];

% defining 'VVolt' which is the range

VVolt=-17.3:0.1:0.9;

% performing interpolation

c=interp1(VV,VVolt);

% printing the data

fprintf(fileid,'%d',VV);

figure

% plotting the interpolated data

plot(-28:-14),VV,'o',VVolt,c,'*');

% changing 'ylabel'

ylabel('voltage');

% changing 'xlabel'

xlabel('current');

% changing the legend

legend('VV','c');

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.