Challenge

Project - Data Handling and Interpolation

1)Answers:

CODE:

A = xlsread('VI.xlsx');
v= A(:,1);
i= A(:,2);
xq= [-17.3:0.1:0.9];
yq1= interp1(v,i,xq);
yq2= interp1(v,i,xq,'spline');
figure(1);
plot(v,i,'o',xq,yq1,':.');
xlabel('voltage(V)');ylabel('current(I)');
title('Linear interpolation (default)');
figure(2);
plot(v,i,'o',xq,yq2,':.');
xlabel('voltage(V)');ylabel('current(I)');
title('Spline interpolation');
i1=interp1(v,i,-17.2);
i2=interp1(v,i,-17.1);
i3=interp1(v,i,-13.8);
i4=interp1(v,i,-13.5);
i5=interp1(v,i,-13);
i6=interp1(v,i,-12.5);
i7=interp1(v,i,-11);
i8=interp1(v,i,-9);
i9=interp1(v,i,-5.76);
i10=interp1(v,i,-6);
i11=interp1(v,i,-1);
i12=interp1(v,i,0.11);
i13=interp1(v,i,0.25);
i14=interp1(v,i,0.5);
i15=interp1(v,i,0.61);
cal_current=('[i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15]');
disp(cal_current)

CODE FOE WRITING DATAS IN A TEXT FILE:

>> projectmatlab
[i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15]
>> fid = fopen('project_matlab.txt','w');
>> len = length(cal_current);
>> for i = 1:len,
fprintf(fid,'%f',cal_current(i));
end;
>> fclose(fid);

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.