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.
>> Data=xlsread('VI.xlsx'); %Data is used to store the data read from the excel sheet
>> V=Data(:,1); %V is used to read the voltage data
>> I=Data(:,2); %I is used to read the current data
>> Vn=[-17.3:0.1:0.9]; %Vn is used to store the values of voltage on which current is to be interpolated
>> In=interp1(V,I,Vn); %In is the function used for interpolation of the data according to Vn
>> plot(V,I,'O',Vn,In,':'); %This command is used to draw a 2-D plot
>> grid; %to provide grid on graph
>> title('VI CURVE'); %Title of the graph
>> xlabel('v'); %X label as voltage
>> ylabel('I'); %Y label as Current
>> fid=fopen('dat1.txt','w'); %dat1.txt file is used to store the data
>> fprintf(fid,'%f\n %f\n %f\n %f\n',V,I,Vn,In); %fid as file id and fprintf is used to print the data to file
>> fclose(fid); % to close the file dat1.txt
%Interpol.m file is attached below to show the script