Challenge

Project - Data Handling and Interpolation

Project Submission Dt: 29/11/202

>> %Project
>> %Data Handling & Interpolation
>>
>> %Now in order to read the available data, we have to call the given data from the project folder.
>> %Function I used to read the given excel file is 'xlsread'
>>
>> %And stored the read numebrs in variable named 'data'.
>> data = xlsread('VC')

data =

-17.3000 -28.0000
-17.1000 -24.0000
-17.0000 -19.0000
-16.8000 -14.0000
-16.5000 -9.0000
-16.0000 -6.0000
-15.0000 -4.0000
-14.0000 -3.0000
-12.0000 -2.0000
-10.0000 -1.3000
-8.0000 -1.0000
-5.0000 -0.6000
-2.0000 -0.3000
-0.2000 -0.1000
0.0900 0
0.1900 0
0.2700 0
0.3900 0.0100
0.4300 0.0300
0.5000 0.1700
0.5500 0.4200
0.6000 1.2300
0.6200 1.9900
0.6500 3.9100

>> %Now by creating two matrices for each data set named 'Volt' & 'Current' we get
>>
>> volt = [-17.3 -17.1 -17 -16.8 -16.5 -16 -15 -14 -12 -10 -8 -5 -2 -0.2 0.09 0.19 0.27 0.39 0.43 0.5 0.55 0.6 0.62 0.65];
>> current = [-28 -24 -19 -14 -9 -6 -4 -3 -2 -1.3 -1 0.6 -0.3 -0.1 0 0 0 0.01 0.03 0.17 0.42 1.23 1.99 3.91];
>>
>> % Now first we plot the graph with the available data set
>> %in figure (1)
>>
>> figure(1); %I named this figure "BeforeInterpolationGraph"
>> plot(volt,current);
>> % The above plot refers to before interpolation
>>
>> % Now in order to perform the interpolation within the required range we stored the interpolated query points in
>> % another variable named 'voltq' & store the interpolated values in 'currentq' which are unknown data values
>>
>>
>> voltq = [-17.3:0.1:0.9]; %Here the volt value starts at -17.3 to 0.9 at a regular interval of 0.1 respectively
>> % Now in order to interp the above volt values we will use func 'interp1' since they are 2D values
>> currentq = interp1(volt,current,voltq,'spline'); %We will use spline method to interpolate the data since
>> %enough no. of known values are given to interpolate
>>
>> %Now for the required graph we will use 'figure(2)' to indetify the unknown values
>> figure(2);

>> plot(volt,current,'o',voltq,currentq,':x')

>> xlabel('Voltage')
>> ylabel('Current')
>> title('Data Handling & Interpolation')
>> legend ('Original Points','Interpolated values')

>> print('-bestfit','FinalInterpolatedGraph','-dpdf');
>> figure(1)
>> xlabel('Voltage')
>> ylabel('Current')
>> title('Before Interpolation')
>> print('-bestfit','BeforeInterpolatedGraph','-dpdf');
>> figure(2)
>> print('-bestfit','FinalInterpolatedGraph','-dpdf');
>>

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.