Project - Data Handling and Interpolation
DATA HANDLING AND INTERPOLATION
AIM:
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.
EXPLANATION:
Interpolation is a method of fitting the data points to represent the value of a function. It is construct new data points within the range of a discrete data set of known data points (x, y). Two types of interpolatrion is used in this project.
1.Linear interpolation
2.Spline interpolation
PROCEDURE:
The given input excel data file is read by using the ‘xlsread’ function command.
The input values of Voltage and current are separated by using this command (:,1) and (:,2).
Interpolation (-17.3:0.1:0.9)
The linear interpolation (y1) is calculated by using this command – Interp1();
For spline interpolation(y2) we use the command – Interp1();
Both cauculation using voltage and current data from "VI.XLS" file file
PLOT DETAILS linear interpolation
After performing the linear interpolation, the plot is plotted.
The linear interpolation is plotted using the figure (1) command.
plot command by providing the actual values of voltage v and current i and the 's' specified square shape of the marker.
The interpolation of the voltage and current is also drawn in the same plot by using x and y1 with an indication of ‘.’
X and Y labels are used to label the x and y-axis. After that for the title of the graph ‘title ()’ command is used.
Then for the legend, we used legend () syntax. In legend syntax, we are using actual values, interpolated values, markers, and line styles.
The legend is placed at the northeast of the graph. For the shape of the marker, we are using ‘s’ as squares.
Then for the grid lines in the graph, we used the “grid” command.
PLOT DETAILS Spline interpolation
After performing the Spline interpolation, the plot is plotted.
The splie interpolation is plotted using the figure (2) command.
plot command by providing the actual values of voltage v and current i and the 's' specified square shape of the marker.
The interpolation of the voltage and current is also drawn in the same plot by using x and y2 with an indication of ‘.’
X and Y labels are used to label the x and y-axis. After that for the title of the graph ‘title ()’ command is used.
Then for the legend, we used legend () syntax. In legend syntax, we are using actual values, interpolated values, markers, and line styles.
The legend is placed at the northeast of the graph. For the shape of the marker, we are using ‘s’ as squares.
Then for the grid lines in the graph, we used the “grid” command
OUTPUT
saving the output data and plots, a text file is created with the name ‘VI_output.txt’ for this used the command 'fopen ()’.
Then the interpolated and spline values are saved by using the ‘fprintf ()’ command.
After the plots are saved using the ‘savefig ()’ command.
Save command used to save the matlab file on location.
RESULT:
1.Interpolation data saved in text file.
2.Interpolated data graph ploted.
3.Program printed in pdf format.
Attachement
1.Command attached in interpolation pdf
2.Output file attached in text fille.
3.Matlab file attached
4.plotted file attached
5.Screenshot file attached( graph and command window)