1
function line_visual(filenamelist,raw_peak_results,int_width_y_mark);
3
%"Stand alone" code to visualize DIC .dat results files
4
%Programmed by Rob slightly changed by Chris
8
%Load the necessary files
10
if exist('filenamelist')==0
13
if exist('raw_peak_results')==0
14
load('raw_peak_results.dat')
16
if exist('int_width_y_mark')==0
17
load('int_width_y_mark.dat')
20
%Number of images to analyze is r; also initialize xpos, y_mark
22
[r,c]=size(filenamelist);
23
xpos_o=raw_peak_results(1,:);
24
y_mark=int_width_y_mark(2,1);
26
%Start analysis of results
28
g=waitbar(0,'Processing the results...');
32
%Calculate displacements and engineering strains (i.e. average strains between
33
%the two selected points...similar to an ISDG measurement)
36
warning off MATLAB:divideByZero
38
xdis=raw_peak_results(m,:)-xpos_o;
39
epsxx=(xdis(2)-xdis(1))/(xpos_o(2)-xpos_o(1));
42
epsxx_plot(m+1)=epsxx*100;
44
%Initialize and then save displacement and strain field data for each image
54
save disp_x.dat xdis_all -ascii -tabs
55
save strain_x.dat epsxx_all -ascii -tabs
57
%Show user strain vs. image number plot and save the data and figure
60
plot(1:r,epsxx_plot,'.-b')
61
axis([1 (max(r)*1.1) 0 (max(epsxx_plot)*1.1)])
62
xlabel('Image Number (Image #1 defined to be the very first image loaded for analysis)')
63
ylabel('Engineering Strain [%]')
64
title('Engineering Strain vs. Image Number')
66
strain_image_data_x=[(1:r)' epsxx_plot'];
67
save strain_image_x.txt strain_image_data_x -ascii -tabs
68
saveas(l,'strain_image_x.fig')
70
%Ask user if a full-figure stress vs. strain plot is desired; save data and figure too
72
plot_selection = menu(sprintf('The displacement and strain values from each image have been saved and plotted.\n An Eng Stress vs. Eng Strain curve can now be generated if the files "time_stress.txt" (raw data from Labview, stress values in [MPa]) and "time_image.txt" (saved by AutoIt)\n are available in the image directory. Matlab will sort through these files and select the correct stress value for a given image and calculated strain using system time as the reference.\n (Note: The matching logic used in this step to correlate the stress and strain values requires that the raw data aquisition rate be at least 2 data points per second.)\n Click "Generate Plot" to do this or click "Exit" to quit Matlab.'),'Generate Plot','Exit');
74
if plot_selection == 1
79
plot(epsxx_plot,stress_image(:,2),'.-b')
80
axis([0 (max(epsxx_plot)*1.1) 0 (max(stress_image(:,2))*1.1)])
81
xlabel('Engineering Strain [%]')
82
ylabel('Engineering Stress [MPa]')
83
title('Engineering Stress vs. DIC Engineering Strain')
85
stress_strain_data_x=[epsxx_plot' stress_image(:,2)];
86
save stress_strain_x.txt stress_strain_data_x -ascii -tabs
87
saveas(n,'stress_strain_x.fig')
89
elseif plot_selection == 2
93
%Ask user if a figure with two subplots is desired...good for presentation animations
95
plot_selection2 = menu(sprintf('A figure with two subplots can now be generated for use in animated presentations.\n (Caution: The .avi movie saved in this step can become very large depending on the number of images analyzed.)\n Click "Generate Subplots" to do this or click "Exit" to quit Matlab.'),'Generate Subplots','Exit');
97
if plot_selection2 == 1
99
%Define counter for image capture and load stress data
106
imshow(filenamelist(M,:))
108
plot(raw_peak_results(1,1),y_mark,'xr','markersize',10) %,'markersize',12
109
plot(raw_peak_results(1,2),y_mark,'xr','markersize',10)
113
plot(raw_peak_results(M,1),y_mark,'xg','markersize',10)
114
plot(raw_peak_results(M,2),y_mark,'xg','markersize',10)
117
title(['Image Correlation Results',sprintf(' (Current image: %10s)',filenamelist(M,:))],'fontweight','bold')
123
plot(epsxx_plot(M),mov_stress(M),'og')
125
axis([0 (max(epsxx_plot)*1.1) 0 (max(mov_stress)*1.1)])
126
xlabel('Engineering Strain [%]','fontsize',8,'fontweight','bold')
127
ylabel('Engineering Stress [MPa]','fontsize',8,'fontweight','bold')
128
title('Engineering Stress vs. DIC Engineering Strain','fontweight','bold')
135
elseif plot_selection2 == 2