Challenge

Project - Data Handling and Interpolation

Solution for this question =

% Solution for interpolation & data handling project
clear all
clc
v= xlsread ('VI.xlsx','sheet1','A2:A25'); % reading the voltage value from VI.xlsx file provided
i= xlsread ('VI.xlsx','sheet1','B2:B25'); % reading the current value from VI.xlsx file provided
range = [-17.3:0.1:0.9]; % defining the range against which interpolation is to be performed
p=interp1(v,i,range, 'spline') % perfroming 2D interpotation of voltage , current with respect to range provided
plot (range,p) % plotting the data for the 1st give range with spline format of interpolation
title ('interpolation for the given range'); % labeling the plots with proper annotation
ylabel( 'p- New interpolated data'); xlabel ('Range');
hold on ; grid on;
r1 =[-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 new range of voltages provided in give question data
p1= interp1 (v,i,r1,'spline') % performing the 2nd interpolation for this new voltage range ad finidng the value of current at each poins
plot(r1,p1,'o');legend('p','p1'); % plotting the point against new range and marking it with O in plot for understanding the data
fileid = fopen('output_interp.txt','w'); %now defining the file id to write/save the data in text file
fprintf(fileid,'%d %f',p1) %now writting this data in text file & closing the fileid
fclose(fileid);

Ouput = enclosed the plot, text files with data.

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.