Challenge

Project - Data Handling and Interpolation

project

editor:-

clc
clear all
x=xlsread('vi.xlsx','A1:A25')
% x is voltage from xlsx sheet from A1 to A25
y=xlsread('vi.xlsx','B1:B25')
% y is current value in amp from xlsx sheet from B1 to B25
[V] =[-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 0.8]
% this the voltage at which
xq=[-17.3:0.1:0.9]
scatter(x,y);hold on;
% to plot scattered voltage vs current graph
yq=[-28:0.1:3.91]
z1=interp1(x,y,xq,'linear');
% interp1 1-D interpolation
% Vq = interp1(X,V,Xq) interpolates to find Vq, the values of the
% underlying function V=F(X) at the query points Xq.
%'linear' - (default) linear interpolation
plot(x,y,'b');grid;hold on;
z2=spline(x,y,V)
% z2 is current values at V found using spline interpolation
%spline Cubic spline data interpolation.
plot(x,y,'m--');hold on;
plot(V,z2,'r');hold off;
xlabel('voltage in volt')
% xlabel('text') adds text beside the X-axis on the current axis.
ylabel('current in amp')
% ylabel('text') adds text beside the y-axis on the current axis.
legend('x and y plot','linear interpolation','spline interpolation','intermidiat volt vs current')
% legend(label1,...,labelN) sets the labels. Specify the labels as a
% list of character vectors, such as legend
fid=fopen('project.txt','w')
% FID = fopen(FILENAME,'w') opens the file FILENAME for writing access.
fprintf(fid,'%3.5f %3.5f\n',z2)
% fprintf Write formatted data to text file.
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.