Project - Data Handling and Interpolation
Question 1:
Solution:
% Read excel file
data=xlsread("main.xlsx");
% Interpolation in range of -17.3:0.1:0.9
x = -17.3:0.1:0.9;
y = interp1(data(:,1), data(:,2), x, 'linear');
% Interactive plot for interpolated data
figure
plot(x,y) %plotting the results
xlabel('X data') %labelling the plot
ylabel('Interpolated Y data')
title('Main Project'); %adding the title
print('main project','-dpdf'); %saving the plot
% Store in text file
txt_filename = 'interpolated_data.txt';
dlmwrite(txt_filename, [x', y'], 'delimiter', '\t')
Here is the code for the interpolation of the given data.