Project - Data Handling and Interpolation
- Matlab Project On Data Handling and Interpolation
Data = xlsread('VI.xlsx'); %d read the excel file
V = Data(:,1); %d import data from excel file
I = Data(:,2); %d import data from excel file
t = -17.3:0.1:0.9; %d give interpolation range
A = []; %d creating matrix for save interpolation data
y = interp1(V,I,t,'spline'); %d using interp1 for find interpolate data
A = [y]; %d interpolated data save in matrix
plot(V,I,'b-','MarkerFaceColor','g','linewidth',1.5); %d plot graph of given data
hold all; %d hold all plots
plot(t,y,'ro','linewidth',1); %d plot graph range vs interpolate data
grid; %d give grid lines
title('Voltage and Current Data Interpolation'); %d give title to graph
xlabel('Voltage (V)');ylabel('Current (I)'); %d labeling graph
xticks([-18:0.5:2]); %d select ticks of x axis
yticks([-40:5:120]); %d select ticks of y axis
xticklabels({'V=',-18:0.5:2}); %d labeling ticks
yticklabels({'I=',-40:5:120}); %d labeling ticks
legend('Data line','Interpolation Line'); %d add legend in graph
text(0.8,39.0701,'Interpolation line','FontSize',15); %d add text
text(-16,-6,'Data line','FontSize',15); %d add text
filename=fopen('Matlab_project.txt','w'); %d open txt file to save interpolate data
writematrix(A','Matlab_project.txt'); %d save interpolated data to txt file
print('Matlab_Project','-dpdf'); %d print graph in pdf formate
fclose(filename); %d closing txt file