% %This is the main program %Any action on the GUI generates a call %to this function, with different 'command_str' % % function acst(command_str) % the first call is with no arguments if nargin == 0 command_str = 'initialize'; end switch command_str case 'initialize', initialize; case 'update_acst_amp', update_acst_amp; case 'update_acst_width', update_acst_width; case 'update_result_range', update_result_range; case 'update_num_waves', update_num_waves; case 'update_frequency', update_frequency; case 'set_default_1', set_default_1; case 'set_default_2', set_default_2; case 'set_default_3', set_default_3; case 'calculate', calculate; case 'click_on_graph', display_value; case 'help', disp_help; case 'introduction', disp_intro; case 'close', close; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% verify valid value for acoustic amplitude %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function update_acst_amp; err_ind = 0; h_amp = findobj('Tag', 'AcoustAmp'); str_amp = get(h_amp, 'String'); eval(['tmp_amp = ' str_amp ';'], 'err_ind = 1;'); if err_ind == 1 set(h_amp, 'String', get(h_amp, 'UserData') ); else if (tmp_amp < 0) str_amp = '0'; elseif (tmp_amp > 1000) str_amp = '1000'; end set(h_amp, 'String', str_amp); set(h_amp, 'UserData', str_amp); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% verify valid value for acoustic width %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function update_acst_width; err_ind = 0; h_width = findobj('Tag', 'AcoustWidth'); str_width = get(h_width, 'String'); eval(['tmp_width = ' str_width ';'], 'err_ind = 1;'); if err_ind == 1 set(h_width, 'String', get(h_width, 'UserData') ); else if (tmp_width < 1) str_width = '1'; elseif (tmp_width > 1000) str_width = '1000'; end set(h_width, 'String', str_width); set(h_width, 'UserData', str_width); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% verify valid value for result range %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function update_result_range; err_ind = 0; h_range = findobj('Tag', 'ResultRange'); str_range = get(h_range, 'String'); eval(['tmp_range = ' str_range ';'], 'err_ind = 1;'); if err_ind == 1 set(h_range, 'String', get(h_range, 'UserData') ); else if (tmp_range < 1) str_range = '1'; elseif (tmp_range > 1000) str_range = '1000'; end set(h_range, 'String', str_range); set(h_range, 'UserData', str_range); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% verify valid value for num of waves %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function update_num_waves; err_ind = 0; h_num = findobj('Tag', 'NumOfWaves'); str_num = get(h_num, 'String'); eval(['tmp_num = ' str_num ';'], 'err_ind = 1;'); if err_ind == 1 set(h_num, 'String', get(h_num, 'UserData') ); else if (tmp_num < 3) str_num = '3'; elseif (tmp_num > 8) str_num = '8'; end set(h_num, 'String', str_num); set(h_num, 'UserData', str_num); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% verify valid value for acoustic frequency %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function update_frequency; err_ind = 0; h_freq = findobj('Tag', 'AcoustFrequency'); str_freq = get(h_freq, 'String'); eval(['tmp_freq = ' str_freq ';'], 'err_ind = 1;'); if err_ind == 1 set(h_freq, 'String', get(h_freq, 'UserData') ); else if (tmp_freq < 0.001) str_freq = '0.001'; elseif (tmp_freq > 100) str_freq = '100'; end set(h_freq, 'String', str_freq); set(h_freq, 'UserData', str_freq); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set default vaues, set #1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function set_default_1 h_freq = findobj('Tag', 'AcoustFrequency'); h_num = findobj('Tag', 'NumOfWaves'); h_range = findobj('Tag', 'ResultRange'); h_width = findobj('Tag', 'AcoustWidth'); h_amp = findobj('Tag', 'AcoustAmp'); set(h_freq, 'string', '8.0'); set(h_num, 'string', '3'); set(h_range,'string', '10'); set(h_width,'string', '20'); set(h_amp, 'string', '5'); set(h_freq, 'UserData', get(h_freq, 'String') ); %back up value set(h_num, 'UserData', get(h_num, 'String') ); %back up value set(h_range,'UserData', get(h_range,'String') ); %back up value set(h_width,'UserData', get(h_width,'String') ); %back up value set(h_amp, 'UserData', get(h_amp, 'String') ); %back up value % h_res = findobj('Tag', 'ResolutionSlider'); % set(h_res, 'Value', 0); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set default vaues, set #2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function set_default_2 h_freq = findobj('Tag', 'AcoustFrequency'); h_num = findobj('Tag', 'NumOfWaves'); h_range = findobj('Tag', 'ResultRange'); h_width = findobj('Tag', 'AcoustWidth'); h_amp = findobj('Tag', 'AcoustAmp'); set(h_freq, 'string', '4.0'); set(h_num, 'string', '3'); set(h_range,'string', '5'); set(h_width,'string', '20'); set(h_amp, 'string', '20'); set(h_freq, 'UserData', get(h_freq, 'String') ); %back up value set(h_num, 'UserData', get(h_num, 'String') ); %back up value set(h_range,'UserData', get(h_range,'String') ); %back up value set(h_width,'UserData', get(h_width,'String') ); %back up value set(h_amp, 'UserData', get(h_amp, 'String') ); %back up value % h_res = findobj('Tag', 'ResolutionSlider'); % set(h_res, 'Value', 0.25); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set default vaues, set #3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function set_default_3 h_freq = findobj('Tag', 'AcoustFrequency'); h_num = findobj('Tag', 'NumOfWaves'); h_range = findobj('Tag', 'ResultRange'); h_width = findobj('Tag', 'AcoustWidth'); h_amp = findobj('Tag', 'AcoustAmp'); set(h_freq, 'string', '1.0'); set(h_num, 'string', '3'); set(h_range,'string', '15'); set(h_width,'string', '20'); set(h_amp, 'string', '50'); set(h_freq, 'UserData', get(h_freq, 'String') ); %back up value set(h_num, 'UserData', get(h_num, 'String') ); %back up value set(h_range,'UserData', get(h_range,'String') ); %back up value set(h_width,'UserData', get(h_width,'String') ); %back up value set(h_amp, 'UserData', get(h_amp, 'String') ); %back up value % h_res = findobj('Tag', 'ResolutionSlider'); % set(h_res, 'Value', 0.25); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% calculate image. %% %% assume near field %% . calculate acoustic wave in water %% . calculate wave front (independent of wave length) %% . calculate phase at wave front %% . calculate ray direction (independent of wave length) %% . calculate interference image %% . repeat calculation for different wave lengthes %% . generate image as sum of all images %% %% X : direction of the acoustic wave %% Y : direction of light beam %% Z : width of acoustic wave (same direction as Y) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function calculate global Acst_Diffraction_Image; global image_size; global axis_size; hide_help; h_click = findobj('Tag','click_on_graph'); set(h_click, 'String',''); set(h_click, 'Visible','off'); h_freq = findobj('Tag', 'AcoustFrequency'); h_num = findobj('Tag', 'NumOfWaves'); h_range = findobj('Tag', 'ResultRange'); h_width = findobj('Tag', 'AcoustWidth'); h_amp = findobj('Tag', 'AcoustAmp'); h_res = findobj('Tag', 'ResolutionSlider'); h_percent= findobj('Tag', 'PercentDone'); eval( ['acoust_freq = ' get(h_freq, 'String') ';' ] ); eval( ['num_of_acst_waves = ' get(h_num, 'String') ';'] ); eval( ['D = ' get(h_width, 'String') ';' ] ); eval( ['Y_range = ' get(h_range, 'String') ';' ] ); eval( ['ref_index_delta = ' get(h_amp, 'String') ';' ] ); resolution = get(h_res,'Value'); set(h_percent, 'Visible', 'on'); acoust_freq = acoust_freq * 1e6; D = D / 1000; Y_range = Y_range / 1000; ref_index_delta = ref_index_delta / 10; acoust_speed = 1500; acoust_wave_len = acoust_speed / acoust_freq; res_X = floor(100 + resolution * 300); res_Y = floor(100 + resolution * 200); res_Z = 200; Y_scale = Y_range / res_Y; X_scale = acoust_wave_len / res_X; num_of_opt_wave_len = 3; opt_wave_len = [400e-9 500e-9 700e-9]; ref_index_wtr = 1.4; acst_wave_len = X_scale * res_X; result = zeros( (num_of_acst_waves + 2) * res_X , res_Y ); x=( 1:res_X ) / res_X; % acoustic wave h_max = acoust_wave_len/6; acst_wave = zeros( res_X , res_Z ); for z_indx = 1:res_Z z = (D/2) * (res_Z - z_indx) / res_Z; R = D^2/8/h_max; h = sqrt( R^2 - z^2 ) - sqrt( R^2 - D^2/4 ); wave_amp = h * ref_index_delta * sin(2*pi*x) + ref_index_wtr; acst_wave( :, z_indx ) = wave_amp'; end optic_length = sum( acst_wave' ) * D / res_Z; % wave front, delta and slope delta_y_wave_fr = ref_index_wtr * D - optic_length; delta_y_wave_fr = delta_y_wave_fr + abs( min(delta_y_wave_fr) ); dy_dx_wave_fr = [ delta_y_wave_fr(1) delta_y_wave_fr ] - [ delta_y_wave_fr delta_y_wave_fr(res_X) ]; dy_dx_wave_fr = dy_dx_wave_fr / X_scale; dy_dx_wave_fr = [ dy_dx_wave_fr(2) dy_dx_wave_fr( 2 : res_X ) ]; for opt_wave_len_indx = 1 : num_of_opt_wave_len wave_len = opt_wave_len(opt_wave_len_indx); % phase at wave front opt_wave_num = optic_length / wave_len; opt_wave_num = opt_wave_num + delta_y_wave_fr * ref_index_wtr /wave_len; opt_wave_num = opt_wave_num - floor( opt_wave_num(1) ); phase_0 = 2*pi*opt_wave_num; res_image = zeros( (num_of_acst_waves + 2)* res_X , res_Y ); x_indx_max = res_X * (num_of_acst_waves + 2); for acst_wave = 0 : (num_of_acst_waves + 1) for x_indx_strt = 1 : res_X percent = (opt_wave_len_indx-1)/num_of_opt_wave_len + ... acst_wave/(num_of_acst_waves+2)/num_of_opt_wave_len + ... x_indx_strt/(res_X+1)/(num_of_acst_waves+2)/num_of_opt_wave_len; percent = int2str( floor(percent*100) ); set(h_percent, 'String', [percent ' % done']); x_strt = x_indx_strt + acst_wave * res_X; y_strt = delta_y_wave_fr(x_indx_strt) / Y_scale; x_indx = x_strt; y_indx = max( [ y_strt 1 ] ); tmp_dx_dy = -dy_dx_wave_fr( x_indx_strt ) * Y_scale / X_scale; if ( (tmp_dx_dy > -1) & (tmp_dx_dy < 1) ) delta_x = tmp_dx_dy; delta_y = 1; else delta_y = abs( 1/tmp_dx_dy ); delta_x = sign( tmp_dx_dy ); end ray_amp = sqrt(1 + ( dy_dx_wave_fr(x_indx_strt) )^2 ); while ( (x_indx >= 1) & (x_indx <= x_indx_max) & (y_indx >= 1) & (y_indx <= res_Y) ) dist_x = (x_indx - x_strt) * X_scale; dist_y = (y_indx - y_strt) * Y_scale; dist = sqrt( dist_x^2 + dist_y^2 ); phase = phase_0( x_indx_strt ) + 2*pi*dist*ref_index_wtr / wave_len; x_indx_int = floor( x_indx ); y_indx_int = floor( y_indx ); res_image( x_indx_int, y_indx_int ) = res_image( x_indx_int, y_indx_int ) + ray_amp * exp(i*phase); x_indx = x_indx + delta_x; y_indx = y_indx + delta_y; end % while end % for x_indx_strt end % for acst_wave result = result + abs( res_image ); end % for opt_wave_len_indx % add the intensity of acousic wave to the graph wave_line_width = floor( resolution * 8 ) + 2; wave = (1+sin(2*pi*x))*127; for indx1=1:wave_line_width for indx2 = 1:num_of_acst_waves tmp1 = (indx2-1) * res_X + 1; tmp2 = indx2 * res_X; img_wave( tmp1:tmp2 , indx1 ) = wave'; end end filter = [ 1 2 1; 2 3 2; 1 2 1 ]; filter = filter / sum(sum(filter)); clr=(0:255)/255; colormap( [ clr' clr' clr' ] ) img = abs(result); img = conv2(img,filter); img = img( (res_X+2) : ( (num_of_acst_waves+1) * res_X + 1) , 2 : (res_Y + 1) ); mx = max(max(img)); img = img * 255/mx; Acst_Diffraction_Image = img; img = [img_wave img]; x_val = [0 (acoust_wave_len * num_of_acst_waves * 1000) ]; y_val = [0 (Y_range * 1000) ]; hide_help; h_image = image(x_val, y_val, img'); xlabel('Distance along acoustic wave [mm]') ylabel('Distance from acoustic wave [mm]') set( h_image, 'ButtonDownFcn','acst(''click_on_graph'');' ); h_percent= findobj('Tag', 'PercentDone'); set(h_percent, 'Visible', 'off'); h_click = findobj('Tag','click_on_graph'); set(h_click, 'String','Click on graph to see intensity:'); set(h_click, 'Visible','on'); image_size = [ size(img) wave_line_width]; axis_size = [x_val(2) y_val(2)]; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Display a value at a selected point of the image %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function display_value; global Acst_Diffraction_Image; global image_size; global axis_size; h_figure = findobj('Tag', 'Acst_Figure'); h_axes = get(h_figure, 'CurrentAxes'); click_point = get(h_axes, 'CurrentPoint'); x_pos = click_point(1,1) / axis_size(1) * image_size(1); y_pos = click_point(1,2) / axis_size(2) * image_size(2); x_pos = min( [ round(x_pos) image_size(1) ] ); % must be inside range y_pos = min( [ round(y_pos) image_size(2) ] ); x_pos = max( [ x_pos 1 ] ); % must be inside range y_pos = max( [ y_pos 1 ] ); y_pos = max( [ y_pos (image_size(3) + 1) ] ); %ignore accoustic wave on image y_pos = y_pos - image_size(3); local_value = Acst_Diffraction_Image( x_pos, y_pos); max_value = max(max( Acst_Diffraction_Image )); prcnt_value = 100*local_value/max_value; prcnt_value_str = num2str( prcnt_value, 4); prcnt_value_str = ['Value is ' prcnt_value_str '% of max intensity' ]; h_click = findobj('Tag','click_on_graph'); set(h_click, 'String', prcnt_value_str ); set(h_click, 'Visible','on'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Introduction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function disp_intro h_help = findobj('Tag', 'HelpBox'); hlp_status = get(h_help, 'Visible'); if strcmp(hlp_status, 'off') show_intro; else hide_help; end function show_intro h_help = findobj('Tag', 'HelpBox'); set(h_help, 'Visible', 'on'); help_btn = findobj('Tag','HelpButton'); set(help_btn, 'String', 'Hide Intro'); intro_btn = findobj('Tag', 'IntroButton'); set(intro_btn, 'String', 'Hide Intro'); intro_string = {... 'Introduction to the diffraction of light by acoustic waves ' '========================================================== ' ' Acoustic wave in water, affects the propagation of light through the water.' ' The acoustic wave in water, is actually a change in the pressure of the water.' ' The pressure directly affects the index of refraction of the water.' ' The speed of light in water is inversly proportional to the index of refraction' ' and the optic length is proportional to the index of refraction ' ' ' ' In this setup, the light passes through the acoustic wave in perpendicular to' ' the direction of the acoustic wave.' ' Beams of light entering the water in-phase, exit in different phases, according' ' to the index of refraction at each piont.' ' ' ' Consider several paralel rays of light, entering the acoustic wave. Each passes ' ' different optic length, so that there are phase differences between the rays ' ' as they get out of the acoustic wave. ' ' This can be considered as different direction for each ray. ' ' After passing through the acoustic wave, diffraction pattern is formed. ' ' ' ' This program calculates the diffraction pattern formed by acoustic wave. ' ' ' }; set(h_help, 'String', intro_string); set(h_help, 'FontSize', 12); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Help %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function disp_help h_help = findobj('Tag', 'HelpBox'); hlp_status = get(h_help, 'Visible'); if strcmp(hlp_status, 'off') show_help; else hide_help; end function hide_help h_help = findobj('Tag', 'HelpBox'); set(h_help, 'Visible', 'off'); help_btn = findobj('Tag','HelpButton'); set(help_btn, 'String', 'Help'); intro_btn = findobj('Tag', 'IntroButton'); set(intro_btn, 'String', 'Introduction'); function show_help h_help = findobj('Tag', 'HelpBox'); set(h_help, 'Visible', 'on'); help_btn = findobj('Tag','HelpButton'); set(help_btn, 'String', 'Hide Help'); intro_btn = findobj('Tag', 'IntroButton'); set(intro_btn, 'String', 'Hide Help'); help_string = {... 'The diffraction of light by acoustic waves ' '========================================== ' ' ' 'This program calculates the diffraction pattern of ' 'light by acoustic waves in water. ' ' ' 'The setup of the experimant is as follows : ' ' An acoustic wave propagates in water. ' ' A beam of white light enters the water in ' ' perpendicular to the direction of the acoustic ' ' wave. ' ' As the light gets out of the acoustic wave, ' ' a diffraction pattern is obtained at distance ' ' determined by the acoustic wave. ' ' ' 'This program calculates a map of light intensities ' 'after passing through the acoustic wave. ' ' ' 'The calculated pattern is shown as a top view of the ' 'requested area. ' ' ' 'The user can set the following parameters : ' '1. frequency : ' ' frequency of the acoustic wave, in MHz ' ' ' '2. number of waves to show : ' ' this determines the number of acoustic waves ' ' for which the diffraction pattern shall be ' ' calculated ' ' ' '3. result range : ' ' distance from the acoustic wave, in mm ' ' the diffraction pattern is calculated from the ' ' acoustic wave, till this distance ' ' ' '4. width of acoustic wave : ' ' the width, in mm, of the acoustic wave ' ' (in the direction of the propagation of ' ' the light) ' ' ' '5. acoustic wave amplitude : ' ' this parameter determines the amount of change ' ' in the index of refraction, caused by the ' ' acoustic wave. ' ' ' 'Three predefined values can be set by the ' '"Default" buttons ' ' ' 'The requested resolution can be set by the ' '"Resolution" slider. The higher the resolution ' 'of calculation, the longer it takes to calculate. ' ' ' }; set(h_help, 'String', help_string); set(h_help, 'FontSize', 12); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% initialize GUI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function initialize close all; clear all; load acst h_fig = figure('Units','points', ... 'Color',[0.8 0.8 0.8], ... 'Colormap',mat0, ... 'Name',' The Diffraction Of Light By Acoustic Wave', ... 'NumberTitle','off', ... 'PointerShapeCData',mat1, ... 'Position',[30 30 520 380], ... 'Tag','Acst_Figure'); % text labels b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[15 355 180 12.75], ... 'String','Acoustic Frequency [0.001 .. 100MHz]', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[15 337 180 12.75], ... 'String','Number Of Waves To Show [3 .. 7]', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[15 319 180 12.75], ... 'String','Result Range [1 .. 1000mm]', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[15 301 180 12.75], ... 'String','Acoustic Wave Width [1 .. 1000mm]', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[15 284 180 12.75], ... 'String','Acoustic Wave Amplitude [0 .. 1000]', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[280 355 36 12.75], ... 'String','MHz', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[280 319 22.5 12.75], ... 'String','mm', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[280 301 22.5 12.75], ... 'String','mm', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'Position',[435 247 57.75 12.75], ... 'String','Resolution', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[430 212 26.25 12.75], ... 'String','Low', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','right', ... 'Position',[468 212 27 12.75], ... 'String','High', ... 'Style','text', ... 'Tag','StaticText1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'Position',[422 161 77.25 12.75], ... 'String','0% done', ... 'Style','text', ... 'Tag','PercentDone'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'HorizontalAlignment','left', ... 'Position',[110 263 246 12.75], ... 'String','Click on graph to see intensity:', ... 'Style','text', ... 'Tag','click_on_graph'); % editable text b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Position',[210 355 63 15], ... 'Style','edit', ... 'Callback','acst(''update_frequency'');', ... 'Tag','AcoustFrequency'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Position',[210 337 63 15], ... 'Style','edit', ... 'Callback','acst(''update_num_waves'');', ... 'Tag','NumOfWaves'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Position',[210 319 63 15], ... 'Style','edit', ... 'Callback','acst(''update_result_range'');', ... 'Tag','ResultRange'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Position',[210 301 63 15], ... 'Style','edit', ... 'Callback','acst(''update_acst_width'');', ... 'Tag','AcoustWidth'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[1 1 1], ... 'Position',[210 284 63 15], ... 'Style','edit', ... 'Callback','acst(''update_acst_amp'');', ... 'Tag','AcoustAmp'); % push buttons b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'Callback','acst(''set_default_1'');', ... 'Position',[435 350 60.75 18.75], ... 'String','Default #1', ... 'Style','pushbutton',... 'Tag','Default_1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'Callback','acst(''set_default_2'')', ... 'Position',[435 326 60.75 18.75], ... 'String','Default #2', ... 'Style','pushbutton',... 'Tag','Default_2'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'Callback','acst(''set_default_3'');', ... 'Position',[435 302 60.75 18.75], ... 'String','Default #3', ... 'Style','pushbutton',... 'Tag','Default_3'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'Callback','acst(''calculate'');', ... 'Position',[430 140 60.75 18.75], ... 'String','Calculate', ... 'Style','pushbutton',... 'Tag','Pushbutton1'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'Callback','acst(''help'');', ... 'Position',[430 105 60.75 18.75], ... 'String','Help', ... 'Style','pushbutton',... 'Tag','HelpButton'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'Callback','acst(''introduction'');', ... 'Position',[430 80 60.75 18.75], ... 'String','Introduction', ... 'Style','pushbutton',... 'Tag','IntroButton'); b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'Callback','acst(''close'');', ... 'Position',[430 45 60.75 18.75], ... 'String','Close', ... 'Tag','Pushbutton1'); % slider b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.752941 0.752941 0.752941], ... 'Position',[430 230 66 15.75], ... 'Style','slider', ... 'SliderStep', [0.25 0.5], ... 'Min', 0, 'Max', 1, ... 'Value', 0.0, ... 'Tag','ResolutionSlider'); % list box b = uicontrol('Parent',h_fig, ... 'Units','points', ... 'BackgroundColor',[0.8 0.8 0.8], ... 'Position',[1 1 420 280], ... 'String',' ', ... 'Min', 0, 'Max', 2, ... 'Style','listbox', ... 'Tag','HelpBox', ... 'Value',1); % graphic screen b = axes('Parent',h_fig, ... 'Units','points', ... 'Box','on', ... 'ButtonDownFcn','acst(''click_on_graph'');', ... 'CameraUpVector',[0 1 0], ... 'CameraUpVectorMode','manual', ... 'Color',[1 1 1], ... 'ColorOrder',mat2, ... 'Position',[40 30 360 230], ... 'Tag','DrawArea', ... 'TickDirMode','manual', ... 'XColor',[0 0 0], ... 'XTickLabelMode','manual', ... 'XTickMode','manual', ... 'YAxisLocation','left', ... 'YColor',[0 0 0], ... 'YDir','reverse', ... 'YTick',[0 0.2 0.4 0.6 0.8 1], ... 'YTickLabel',['0 ';'0.2';'0.4';'0.6';'0.8';'1 '], ... 'YTickLabelMode','manual', ... 'YTickMode','manual', ... 'ZColor',[0 0 0]); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HandleVisibility','callback', ... 'HorizontalAlignment','center', ... 'Position',[0.497326 -0.0263158 0], ... 'Tag','Text4', ... 'VerticalAlignment','bottom'); set(get(c,'Parent'),'Title',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HandleVisibility','callback', ... 'HorizontalAlignment','center', ... 'Position',[0.497326 1.03008 0], ... 'Tag','Text3', ... 'VerticalAlignment','cap'); set(get(c,'Parent'),'XLabel',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HandleVisibility','callback', ... 'HorizontalAlignment','center', ... 'Position',[1.07219 0.503759 0], ... 'Rotation',90, ... 'Tag','Text2', ... 'VerticalAlignment','cap'); set(get(c,'Parent'),'YLabel',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HandleVisibility','callback', ... 'HorizontalAlignment','right', ... 'Position',[-0.0935829 -0.703008 0], ... 'Tag','Text1', ... 'Visible','off'); set(get(c,'Parent'),'ZLabel',c); set_default_1 h_percent = findobj('Tag', 'PercentDone'); set(h_percent, 'Visible', 'off'); h_click = findobj('Tag', 'click_on_graph'); set(h_click, 'Visible', 'off'); hide_help; axis off;