Challenge

Project - Data Handling and Interpolation

Project :

In a laboratory experiment, data of voltage and current has been recorded and the same is attached in an excel file ( Click on this link VI.xlsx ). Read the excel file in the Matlab program and perform the interpolation in the range of -17.3:0.1:0.9. Generate the interactive plot for the interpolated data and store them in a text file.

Key Highlights:

  • Graphical solutions are more visual and appealing
  • Interpolation of data
  • Read excel file
  • Write to text file

Deliverables:

  • Find missing data and save it in text
  • Interpolate the data set
  • Save your program and attach the same.
  • Save txt file and upload in attachment
Solution:
data=readmatrix('VI.xlsx');
V=data(:,1); % Defined Variable from Excel file (voltage)
I=data(:,2); % Defined Variable from Excel file (Current)
xq=-17.3:0.1:0.9; % Range of Interpolation
yq1=interp1(V,I,xq,'spline'); % Spline Interpolation
figure(1)
plot(V,I,'o',xq,yq1,':'); % Plotting Spline Interpolation
title('Spline Interpolation');
legend('Original','Spline Interpolated','Location','Southeast');
xlabel('Voltage (V)');
ylabel('Current (I)');
grid on
yq2=interp1(V,I,xq,'Linear'); % Linear Interpolation
figure(2)
plot(V,I,'o',xq,yq2,':'); % Plotting Interpolation
title('Linear Interpolation');
legend('Original','Linear Interpolated','Location','Southeast');
grid on
xlabel('Voltage (V)');
ylabel('Current (I)');
%% Storing in text file
M=[xq' yq1']
writematrix(M,'Spline output.txt')

Figure(1) :
Figure(2) :
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.