Challenge

Project - Data Handling and Interpolation

clear all
clc
r=xlsread("av.xlsx"); %changed the file name to 'av' for my personal easiness; using xlsread command read the file
x=r(:,1); %extract the voltage data
y=r(:,2) %extract the Current data
z=[-17.3:0.1:0.9];% range to interpolate data.
e=interp1(x,y,z); %interpolation using interp1 command
figure(1);
plot(x,y,'o',z,e,':.'); %plotted the datas of x,y,and z
grid on ;xlabel('Voltage');ylabel('Current');
title('LINEAR INTERPOLATION')
j=interp1(x,y,z,'spline');%spline for more data points and smoother curve
figure(2);
plot(x,y,'o',z,j,':.');grid;title('spline');xlabel('Voltage');ylabel('current')
f=fopen('Interpolation_Data.txt','w'); %creating a text file named Interpolation data,\n for new line
fprintf(f,' z \t e \t j\n '); %for creating headers in fileid f
fprintf(f,'%.2f %.2f %.2f\n',[z;e;j]); %assigning values of z e j under their headers respectively
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.