Project - Data Handling and Interpolation
Q1.
Aim:
Project :
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.
Key Highlights:
- Graphical solutions are more visual and appealing
- Interpolation of data
- Read excel file
- Write to text file
Deliverables:
- Find missing data and save it in text
- Interpolate the data set
- Save your program and attach the same.
- Save txt file and upload in attachment
Ans:
Here we have used the command 'interp1' for interpolation. The output xq1 is put to the text file called 'interpolation'.
Code for interpolation:
fileID = fopen('interpolation.txt','w'); % Open the text file to write the output
x = ImAmp; % defining a variable x from excel file
y = VVolt; % defining a variable y from excel file
xq = [-17.3:0.1:0.9]; % defining the range for interpolation
xq1 = interp1(y,x,xq); % interpolation
figure(1);
plot(x,y,'o',xq,xq1,':'); % plotting the interpolation
grid;
fprintf(fileID,'%f','xq1'); % print the output xq1 to the text file
Workspace:

Output:

Output in text file:
