%read CSV file filename = 'C:\Users\Karthik\Documents\Git Repos\ULE Cavity Characterisitics\ReflectivityCurve_ULECavity.csv'; delimiter = ','; startRow = 1; formatSpec = '%f%f'; fileID = fopen(filename,'r'); dataset = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'EmptyValue', NaN, 'ReturnOnError', false, 'EndOfLine', '\r\n'); fclose(fileID); wavelengths = dataset{1}; reflectance = dataset{2}; figure(1); clf; xq = 549:1:1100; vq1 = interp1(wavelengths(30:end),reflectance(30:end),xq); plot(wavelengths,reflectance,'o',xq, vq1,':.'); %scatter(wavelengths, reflectance, 'LineWidth', 2) R_626 = vq1(xq==626); R_842 = vq1(xq==842); F_626 = pi * sqrt(R_626) / (1 - R_626); F_842 = pi * sqrt(R_842) / (1 - R_842); hold on plot(626, R_626, 'o', 'MarkerSize', 15, 'LineWidth', 3) line([626 626], [0 2],'Color','red','LineStyle','--') line([500 1100], [R_626 R_626],'Color','red','LineStyle','--') text(630, R_626 - 0.1, sprintf('626, %.3f', R_626)) text(630, R_626 - 0.15, sprintf('F = %.3f', F_626)) %annotation('arrow', [0.293 0.293], [0.11 0.3]); plot(842, R_842, 'o', 'MarkerSize', 15, 'LineWidth', 3) line([842 842], [0 2],'Color','red','LineStyle','--') line([500 1100], [R_842 R_842],'Color','red','LineStyle','--') text(846, R_842 - 0.1, sprintf('842, %.3f', R_842)) text(846, R_842 - 0.15, sprintf('F = %.3f', F_842)) %annotation('arrow', [0.571 0.571], [0.11 0.2]); hold off hXLabel = xlabel('Wavelength (nm)'); hYLabel = ylabel('?? Mirror Reflectivity R(%) ??'); hTitle = sgtitle('??Reflectivity Curve of the ULE Cavity Mirrors??'); set([hXLabel, hYLabel] , ... 'FontSize' , 14 ); set( hTitle , ... 'FontSize' , 18 ); grid on