Project - Data Handling and Interpolation
answer)
clc
clear
close all
%reading data from excel
a=xlsread("VI.xlsx");
v=a(:,1);
i=a(:,2);
% interpolation linear
x=-17.3:0.1:0.9;
l=interp1(v,i,x);
% spline method m
m=interp1(v,i,x,'spline');
% computing current n for the given vv voltage data
y=[-17.2 -13 -11 -9 -6 -1 0.11 0.25 0.5 0.61 0.66];
n=interp1(v,i,y);
% ploted the v vs i
subplot(2,2,1);
plot(v,i,'o','LineWidth',2);
grid on
axis([-18 2 -30 5]);
xlabel('voltage v volt');
ylabel('current I ampare');
title('v vs i data')
% spline interpolation
subplot(2,2,2);
plot(v,i,'o',x,m,'g');
grid on
axis([-18 2 -30 5])
xlabel('voltage v volt');
ylabel('current i ampair');
title('v vs i splain interpolatin')
% liner interpolatin
subplot(2,2,3);
plot(v,i,'o',x,l,'g');
grid on
axis([-18 2 -30 5]);
xlabel('volatage v volt');
ylabel('current I ampair');
title('v vs i linear interpolation')