Challenge

Project - Data Handling and Interpolation

Project - Data Handling and Interpolation

clear all
clc
DATA=xlsread("VI.xlsx"); %reading excel sheet using xlsread.
V=DATA(:,1); %fetching voltage data from column 1 from excel sheet
I=DATA(:,2); %fetching current data from column 1 from excel sheet
R=-17.3:0.1:0.9; %range for interpolation
VIR1=interp1(V,I,R); %linear interpolation syntax.
VIR2=interp1(V,I,R,'spline'); % spline interpolation syntax.
figure(1)
plot(I,V,'o',R,VIR1,':.') %plot for linear interpolation.
grid;
title('Linear Interpolation')
xlabel('Voltage (V)');
ylabel('Current (I)');
figure(2)
plot(V,I,'s',R,VIR2,'b: .');
title('Spline Interpolation'); %plot for spline interpolation.
xlabel('Voltage (V)');
ylabel('Current (I)');
A=fopen('VI_output.txt','w'); %saving interpolated data in text A.
fprintf(A,' Voltage Currentn');
fprintf(A,'%4.3f %5.3fn',R,VIR1); %writing voltage and current value.
savefig(1,'linear.fig'); %saving graph for linear interpolation
savefig(2,'spline.fig'); %saving graph for spline interpolation
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.