Challenge

Project - Data Handling and Interpolation

1.

matrix=xlsread("VI.xlsx");

len1=length(matrix);

for i = 1:len1

v(i)=matrix(i)

end;

for j = 25:48

c(j-24)=matrix(j)

end;

v =

Columns 1 through 9

-17.3000 -17.1000 -17.0000 -16.8000 -16.5000 -16.0000 -15.0000 -14.0000 -12.0000

Columns 10 through 18

-10.0000 -8.0000 -5.0000 -2.0000 -0.2000 0.0900 0.1900 0.2700 0.3900

Columns 19 through 24

0.4300 0.5000 0.5500 0.6000 0.6200 0.6500

c =

Columns 1 through 9

-28.0000 -24.0000 -19.0000 -14.0000 -9.0000 -6.0000 -4.0000 -3.0000 -2.0000

Columns 10 through 18

-1.3000 -1.0000 -0.6000 -0.3000 -0.1000 0 0 0 0.0100

Columns 19 through 24

0.0300 0.1700 0.4200 1.2300 1.9900 3.9100

e=polyfit(v,c,1);

>> e

e =

0.8481 1.3905

>> c=e(1)*v+e(2);

>> vq=[-17.3:0.1:0.9];

>> yq=interp1(v,c,vq,'spline');

>> plot(v,c,'o',vq,yq,':.');

id=fopen('interpolation_values.txt','w');

>> len2=length(yq);

>> for k = 1:len2

fprintf(fid,'%d\n',yq(k));

end;

>> fclose(fid);

legend('actual','interpolated');

>> xlabel('Voltage V');ylabel('Current c');

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.