Challenge

Project - Data Handling and Interpolation

Project: Data Handling and Interpolation

Objective:

  • Read the excel file in the Matlab program.
  • 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.

Data Handling:

  • Data handling is collecting, organizing and presenting the data in such a way that is helpful to analyse and make a conclusion.

Interpolation:

  • Interpolation is a process of determining the unknown values that lie in between the known data points.

Matlab Codes:

clc;
clear all;
close all;
Data = xlsread("VI.xlsx");% Read data from VI Excel sheet.
Vol=Data(:,1);% First Columb in Data is for Voltage
Curr=Data(:,2);% Seconad Columb in Data is for Current
Vol1=-17.3:0.01:0.9;% range of voltage interpolation
Curr1=interp1(Vol,Curr,Vol1,'spline');%Spline Interpolation
subplot(221);plot(Curr,Vol,'o');ylabel('Voltage');xlabel('Current');title('Given Data');axis([-20 5 -20 5]);
subplot(222);plot(Curr1,Vol1,':.');ylabel('Voltage');xlabel('Current');title('Spline interpolation');axis([-20 5 -20 5]);
subplot(223);plot(Curr,Vol,'-o',Curr1,Vol1);ylabel('Voltage');xlabel('Current');title('Given Data Vs Interpolation');axis([-20 5 -20 5]);
Voltage =[-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];% Given Voltage Data
Current = interp1(Vol,Curr,Voltage,"spline");% Using 'interp1' function for calculating Current
subplot(224);plot(Current,Voltage,'m--');grid;title('Calculated Value Of Current Vs Given data of Voltage');ylabel('Volt');xlabel('Amp');
fid = fopen('Voltage Vs Current.txt','w');% opening text file in writing mode
fprintf(fid,'Voltage Current\n');% storing value of variable in file
for i = 1:length(Voltage)
fprintf(fid,'%.3f %.3f\n',Voltage(i),Current(i));% storing value in file
end
fclose(fid);% closing output file

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.