Project - Data Handling and Interpolation
1).MY MATLAB CODE IS
clc
clear all
close all
%reading the exl file
data = xlsread('C:\Users\User\Downloads\VI.xlsx');
V= data(:,1);
I = data (:,2);
xq=-17.3:0.1:0.9;
yq1=interp1(V,I,xq); % Linear interpolation
yq2=interp1(V,I,xq,'spline'); % Spline interpolation
figure(1);
plot(V,I,'o',xq,yq2,':')
grid;
title('Linear interpolation');
figure(2);
plot(V,I,'o',xq,yq2,'.');
grid;
title('Spline Interpolation');
[X,Y]=meshgrid(-4:4,-4:4);
Z=Y.* exp(-X.^2-Y.^2);
figure(1); surf(X,Y,Z);title('original sampling');
[Xq1,Yq1]=meshgrid(-4:0.4:4,-4:0.4:4);
Zq1=interp2(X,Y,Z,Xq1,Yq1);
figure(2); surf(Xq1,Yq1,Zq1);%surf plot
title('Linear Interpolation using Finer grid');
[Xq2,Yq2]=meshgrid(-4:0.4:4,-4:0.4:4); %meshgrid
Zq2=interp2(X,Y,Z,Xq2,Yq2);
figure(3);
surf(Xq2,Yq2,Zq2);
title('Cubic Interpolation over a Finer Grid');
% Writting the data file in text file from
file=fopen('finalproject.text','w');
fprintf(file,'%f,%d\n',data);
fclose(file);
MY MATLAB SCREEN IS

FIGURE(1)

FIGURE(2)

FIGURE(3)

WRITTING TEXT.FILE
