Challenge

Project - Data Handling and Interpolation

AIM : To 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

Answer:

clc
clear all
x=xlsread('VI.xlsx','Sheet1') % loading data from excel sheet 1
vvolt=x(:,1);
ImAmp=x(:,2);
vv=interp1(vvolt,ImAmp)
figure (1)
plot(vvolt,ImAmp,'-ob');grid;hold;
xlabel('volt');ylabel('Amps');
legend('interpolation of volt and Amps');
title('interploation of data from excel sheet');
print('output_interp from xlsx data','-dpdf');
fileid1=fopen('E:\matlab installer\bin\programs\project\VI.xlsx','r');
fileid=fopen('E:\matlab installer\bin\programs\project\interp.txt','W');
VV =[-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];
VVolt=[-17.3:0.1:0.9];
c=interp1(VV,VVolt)
fprintf(fileid,'%d',VV)
figure(2)
plot((-28:-14),VV,'o',VVolt,c,'-');grid;
xlabel('volt');ylabel('Amps');
legend('VV','c');
title('interpolation of VV and VVolt');
print('output_interp of VV and VVolt','-dpdf');

command window:

x =

-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


vv =

NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
NaN
-17.2540
-17.1020
-16.8180

Current plot held

c =

Columns 1 through 19

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Columns 20 through 38

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Columns 39 through 57

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Columns 58 through 76

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Columns 77 through 95

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Columns 96 through 114

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Columns 115 through 133

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Columns 134 through 152

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Columns 153 through 171

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Columns 172 through 183

NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN


ans =

138

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.