Project - Data Handling and Interpolation
Project - Data Handling and Interpolation :
close all
clear all
clc
%%interpolation 0f voltage and current ranges
A = xlsread("VI (1).xlsx");%loading excel file
volt = A(: , 1);
Amp = A(: , 2);
x = -17.3:0.1:0.9;%interpolation range
yq = interp1(volt,Amp,x);%linera interpolation
yq2 = spline(volt,Amp,x);%spline interpolation
figure(1)
plot(volt,Amp,'g-o',x,yq,'m--');%ploting linear interpolation
hold on ; grid on;
xlabel('voltage');
ylabel('current');
title("liner interpolation")
figure(2)
plot(volt,Amp,'g-o',x,yq2,'m-..');%ploting spline interpolation
title("spline interpolation")
xlabel('voltage');
ylabel('current');
fileID = fopen('majorproject1.txt','w'); %save and write text file
fprintf(fileID,'%2.5f\n',x); %print a text file
fclose(fileID);
fileID = fopen('major1project1.txt','r');
formatSpec = '%f';
A = fscanf(fileID,formatSpec) %read text file
fclose(fileID);

%%creating text file
