Challenge

Project - Data Handling and Interpolation

Project:

>> VI=xlsread('VI.xlsx'); %loads excel data
>> V=VI(:,1); %1st column of VI is assigned to V
>> I=VI(:,2); %2nd column of VI is assigned to I
>> xq=[-17.3:0.1:0.9];
>> yq=interp1(V,I,xq); %interpolating for the given range
>> figure(1);
>> plot(V,I,'o',xq,yq,':.');grid;
>> xlabel('Voltage (V)');ylabel('Current (I)');title('Interpolation');
>> yq1=interp1(V,I,xq,'spline'); %spline curve
>> figure(2);
>> plot(V,I,'o',xq,yq1,':.');grid;
>> xlabel('Voltage (V)');ylabel('Current (I)');title('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];
>> II=[];
>> M=[];
>> for i=VV
M=interp1(V,I,i); %interpolating the given voltage values to find the respective current value
II=[II M];
end
>> fid=fopen('Interpolation.txt','w'); %writing the current values to a text document
>> len=length(II);
>> for i=1:len
fprintf(fid,'%d\n',II(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.