Project - Data Handling and Interpolation
%% Aim In a laboratory experiment, data of voltage and current has been recorded and the same is attached in an excel file ( Click on this link VI.xlsx ). Read the excel file in the Matlab program and perform the interpolation in the range of -17.3:0.1:0.9. Generate the interactive plot for the interpolated data and store them in a text file.
Code:
Data = xlsread('VI.xlsx'); %Open the Excel file To read the Data
vvolts=Data(:,1); %Defining A varible vvolts from excel file
ImAmps= Data(:,2); %Defining A Variable ImAmps from excel file
xq = -17.3:0.1:0.9; % Define A Range of interpolation
xq1 = interp1(vvolts,ImAmps,xq); %Done interpolation
figure(1);
plot(vvolts,ImAmps,'-r',xq,xq1,'+r'); %plot the interpolation Result
grid;
fileID= fopen('Interpolation_data.txt','w'); %Open interpolation_data.txt file
fprintf('%d\n',vvolts,ImAmps); %Save the value of vvolts And ImAmps in interpolation_data.txt
fclose(fileID); %Close The File