Challenge

Project - Data Handling and Interpolation

OBJECTIVE

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

AIM

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.

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]’

ANSWER

data=readmatrix("VI.xlsx");
V=data(:,1);
I=data(:,2);
x=-17.3:0.1:0.9;
m=interp1(V,I,x,'linear');
plot(V,I,x,m,'r*');
vv=[-17.2
-13
-11
-9
-6
-1
0.11
0.25
0.5
0.61
0.66];
ii=interp1(V,I,vv);
z=[vv ii];
% xlabel('voltage');
% ylabel('current');
legend('VV','ii');
%Xlabel ylabel title legend saveing in text format  

ileidl=fopen('C:\users\marag\Documents\week3.xlsx','r');
fileid=fopen('C:\users\marag\Documents\Dataproject.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;
ii=interp1(V,I,vv);
fprintf(fileid,'%d','VV');
figure
plot((-28:-14),VV,'o',VVolt,1i,'*');
ylabel('voltage');
xlabel('current');
legend('VV','i');

title('linear interpolation')
figure(2)
plot(V,I,'o',V1,Ib2,':.') % plot spline interpolation
grid
title('spline interpolation')
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]; % new voltage range
I2=interp1(V,I,VV); %linear interpolation for find value of current
figure(3)
plot(VV,I2,'o--') % plot linear interpolation for new voltage and current value
grid
VVI2=[VV;I2]; % save value in matrix
fid=fopen('I.txt','w'); % Write to text file
fprintf(fid,'%6s %12s\n','Voltage','Current'); % title for voltage and current
fprintf(fid,'%6.2f %12.8f\n',VVI2); % save data for voltage and current
fclose(fid);

CONCLUSION

Hence the output result has plotted and verified.

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.