Project - Data Handling and Interpolation
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
solution)
[data1]=xlsread('VI.xlsx');
%reading the value of V and I as in the given sheet
[data2]=[-17.2;-13;-11;-9;-6;-1;0.11;0.25;0.5;0.61;0.66];
%the interpolated points of voltage on which we have to fing the I values
x=data1(:,1);
%the matrix which store the first column of the given sheet
%the V values
y=data1(:,2);
%the matrix which store the second column of the given sheet
%the i values
yi=interp1(x,y,data2);
%using interpolationn we need to fing the points in linear way
yii=interp1(x,y,data2,"spline");%zlinier,cubic,spline 3 can be use
figure(1);
plot(x,y)
%ploting the graph beetween the x and y
grid on;
legend('V (Volt)','I (mAmp)')
xlabel('voltage')
ylabel('current')
title('the observation graph')
figure(2);
plot(x,y,'o',data2,yii,':.')
%ploting the graph beetween interpolation points
grid on;
legend('V (Volt)','I (mAmp)')
xlabel('interpolated voltage value')
ylabel('interpolated current value')
title('the interpolated required graph ')
filename=fopen('untitled.txt','w')
%open the saved text file by using fopen
dd=[yii]
%saving the interpolation points to a dd variable
fprintf(filename,'%f\n',dd)
%to write in the text file we have used the 'w' and the saved interpolated
% points in the text file