Challenge

Project - Data Handling and Interpolation

%Matlab Basics Final Project
lab_exp=xlsread("VI.xlsx"); % Reading and loading data from excel sheet
x=lab_exp(:,1); % storing all the values of column 1 of Voltage
y=lab_exp(:,2); % storing all the values of column 1 of Current
t = -17.3:0.1:0.9; % Range of Interpolation
xq1 = interp1(x,y,t); % linear interpolation
xq2 = interp1(x,y,t,'spline'); %spline interpolation
figure(1);
plot(x,y,'r*',t,xq1,'g+'); % Plot showing raw data and Linearly interpolated data
xlabel('Voltage V');
ylabel('Current mAmp');
title('Linearly Interpotated');
legend('Raw Data','Interpolated Data');
figure(2);
plot(t,xq1,'g+',t,xq2,'r');% Plot showing Linearly interpolated data and spline interpolated data
xlabel('Voltage V');
ylabel('Current mAmp');
title('Spline Interpotated');
legend('Linearly Interpolated','Spline Interpolated');
fid = fopen('VI_interpolated_data.txt','w'); % Open or creates a text file named VI_interpolated_data
ln = length(lab_exp); % To find the length of the vector variable lab_exp
for i = 1:ln % Run the loop from 1 to length of the vector variable lab_exp
fprintf(fid,'%d\n',lab_exp(i)); % Writes the value to the txt file
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.