Challenge

Project - Data Handling and Interpolation

TEAM SKILL LYNC

% Project 4

clc;

a = xlsread('vifile1.xls'); %Read the xls file

V = a(:,1); %store Voltage column value of 'f' in 'V'

I = a(:,2); %store Current column value of 'f' in 'A'

Vinp = -17.3:0.1:0.9;% Range of Voltage

Iinp = interp1(V,I,Vinp,"spline");% Using 'interp1' spline function for calcs Current for given Volt Range 'Vinp'

figure(1);

subplot(121)

plot(V,I,'-g');grid;% Plot

title('Lab Data'); % Chart title

xlabel('V-Volt'); % Lable X axis

ylabel('I-mAmp'); % Lable Y axis

axis([-20 5 -30 5]); % Axis limits

subplot(122)

plot(Vinp,Iinp);grid; % Plot

title('Interpolation Data');%giving title for the figure

xlabel('V-Volt)'); % lable X axis

ylabel('I-mAmp)'); % lable Y axis

axis([-20 5 -30 5]);%Defining axis limits

figure(2);

plot(V,I,'o',Vinp,Iinp);grid; %plot the values

title('Volt-V vs Current-I Validation plot'); % Plot title

xlabel('V-Volt'); % label X axis

ylabel('I-mAmp'); % label Y axis

legend('Lab Data','Interpolation Data'); % Plot legends

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];% Given Voltage Data IN %problem

VI = interp1(V,I,VV,"spline");% Using 'interp1' spline function for calculating Current value for given Voltage

figure(3);

plot(VV,VI,'-o'); %ploting the values

grid; 

title('Calc Value I-mAmp Vs Given data V-Volt');% Plot title

xlabel('V-Volt');% label X  axis

ylabel('I-mAmp'); % label Y axis

fid = fopen('Volt_and_Current.txt','w'); % Create /open output file

fprintf(fid,'V-Volt I-mAmp \n'); % store value of variable x in file

for i = 1:length(VV)

fprintf(fid,'%.3f %.3f\n',VV(i),VI(i)); % store value of variable x in file

end

fclose(fid);% close output file

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.