Challenge

Project - Data Handling and Interpolation

D=readmatrix('VI.xlsx'); % read the excel matrix.
v=D(:,1); % Load the voltage fron row 1
i=D(:,2); % Load the current from row 2
xq=-17.3:0.1:0.9; % Given Interpolation data.
yq1=interp1(v,i,xq); % for linear Interpolation.
yq2=interp1(v,i,xq,'spline'); % for spline interpolation.
figure(1)
plot(v,i,'s',xq,yq1,': .'); % plot the linear interpolation graph.
title('Linear Interpolation');
xlabel('Voltage(V)');
ylabel('current(I)');
grid on;
figure(2)
plot(v,i,'s',xq,yq2,'b: .'); % plot the spline interpolation graph.
title('Spline Interpolation');
xlabel('Voltage(V)');
ylabel('Current(I)');
grid on
vol_cu=fopen('VI_Output.txt','w'); % Save the interpolation data to text file
fprintf(vol_cu,'Voltage Current\n');
fprintf(vol_cu,'%4.3f %5.3f\n',xq,yq2);
savefig(1,'vilinear.fig'); % saving the linear interpolation data
savefig(2,'splinear.fig'); % saving the spline interpolation data
fclose(vol_cu);
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.