clear all close all fig1 = figure(); global ax ax = axes('position', [0.05 0.5 0.4 0.4]); e = 5 f = 0.05 x = -e:f:e; A = 2; b = 1; c = 0; d = 0; y = A*sin(b*(x+c)+d); plot (x,y); axis ('tight'); hold on G = 1; h = 1; i = 0; j = 0; y = G*cos(h*(x+i)+j); plot (x,y); axis ('tight'); function show_grid v = get (gcbo, 'value'); grid (merge(v, 'on', 'off')); end; function minor_grid w = get (gcbo, 'value'); grid ('minor', merge (w, 'on', 'off')); end; function edit_plot_title global ax u = get (gcbo, 'string'); set (get (ax, 'title'), 'string', u); end; function print_plot [filename, pathname] = uiputfile ('*.pdf') ; if isequal(filename,0) || isequal(pathname,0) errordlg('No Print!','File Error: No valid path/filename'); else print ([filename]); end ; end; plot_title_label = uicontrol (fig1,'style', 'text',... 'units', 'normalized',... 'string', 'Plot title',... 'horizontalalignment', 'left',... 'position', [0.6 0.9 0.35 0.08]); plot_title_edit = uicontrol (fig1,'style', 'edit',... 'units', 'normalized',... 'string', 'edit me',... 'horizontalalignment','left', ... 'callback', @edit_plot_title,... 'position', [0.6 0.85 0.35 0.06]); grid_checkbox = uicontrol (fig1,'style', 'checkbox',... 'units', 'normalized',... 'string', 'show grid',... 'callback', @show_grid,... 'position', [0.05 0.3 0.35 0.08]); minor_grid_toggle = uicontrol (fig1,'style', 'togglebutton',... 'units', 'normalized',... 'string', 'minor',... 'callback', @minor_grid,... 'position', [0.2 0.3 0.1 0.08]); plot_button = uicontrol (fig1,'style', 'pushbutton',... 'units', 'normalized',... 'string', 'plot',... 'position', [0.05 0.1 0.35 0.08]); bg = uibuttongroup (fig1, "Position", [ 0.5 0.1 0.2 0.3]); b1 = uicontrol (bg, "style", "checkbox",... "string", "Sinus",... "Position", [ 20 80 70 20 ]); b2 = uicontrol (bg, "style", "checkbox",... "string", "Cosinus",... "Position", [ 20 50 70 20]); b3 = uicontrol (bg, "style", "checkbox",... "string", "Tangens",... "Position", [ 20 20 70 20 ]); amplitude = uicontrol (fig1, 'style', 'text',... 'units', 'normalized',... 'horizontalalignment', 'left',... 'string', 'amplitude',... 'position', [0.72 0.35 0.3 0.06]); sin_amplitude = uicontrol (fig1, 'style', 'edit',... 'units', 'normalized',... 'horizontalalignment', 'left',... 'string', 'x0 sin',... 'callback', @show_grid,... 'position', [0.72 0.3 0.08 0.04]); cos_amplitude = uicontrol (fig1, 'style', 'edit',... 'units', 'normalized',... 'horizontalalignment', 'left',... 'string', 'x0 cos',... 'position', [0.72 0.23 0.08 0.04]); tan_amplitude = uicontrol (fig1, 'style', 'edit',... 'units', 'normalized',... 'horizontalalignment', 'left',... 'string', 'x0 tan',... 'position', [0.72 0.15 0.08 0.04]); periodenlaenge = uicontrol (fig1, 'style', 'text',... 'units', 'normalized',... 'horizontalalignment', 'left',... 'string', 'periode',... 'position', [0.85 0.35 0.3 0.06]); sin_periodenlaenge = uicontrol (fig1, 'style', 'edit',... 'units', 'normalized',... 'horizontalalignment', 'left',... 'string', 'T sin',... 'position', [0.85 0.3 0.08 0.04]); cos_periodenlaenge = uicontrol (fig1, 'style', 'edit',... 'units', 'normalized',... 'horizontalalignment', 'left',... 'string', 'T cos',... 'position', [0.85 0.23 0.08 0.04]); tan_periodenlaenge = uicontrol (fig1, 'style', 'edit',... 'units', 'normalized',... 'horizontalalignment', 'left',... 'string', 'T tan',... 'position', [0.85 0.15 0.08 0.04]); xachsenabschnitt = uicontrol (fig1, 'style', 'text',... 'units', 'normalized',... 'horizontalalignment', 'left',... 'string', 'x-intercept',... 'position', [0.55 0.6 0.3 0.06]); xmin = uicontrol (fig1, 'style', 'edit',... 'units', 'normalized',... 'string', 'x min',... 'horizontalalignment', 'left',... 'position', [0.52 0.55 0.08 0.04]); xmax = uicontrol (fig1, 'style', 'edit',... 'units', 'normalized',... 'string', 'x max',... 'horizontalalignment', 'left',... 'position', [0.62 0.55 0.08 0.04]); print_pushbutton = uicontrol (fig1,'style', 'pushbutton', 'units', 'normalized', 'string', 'print plot', 'callback', @print_plot, 'position', [0.6 0.7 0.2 0.05]);