-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsimpleGUI.m
More file actions
33 lines (31 loc) · 1.03 KB
/
Copy pathsimpleGUI.m
File metadata and controls
33 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function simpleGUI()
% GAUSSGUI visualize properties of hermite-gaussian beams
close all;
lambda = 5;
x = linspace(0,2,30);
xc = linspace(0,2,500);
y = cos(2*pi*x/lambda);
yc = cos(2*pi*xc/lambda);
hf = figure('Units','normalized','Position',[0 0 1 1],'MenuBar','none','ToolBar','none','Units','normalized');
ha = axes('OuterPosition',[.02 .10 .9 .85]);
hstem = stem(x,y,'k');
set(hstem,'YDataSource','y');
set(hstem,'XDataSource','x');
title('The Effect of Aliasing on a Sampled Sine-Wave','FontWeight','bold');
ylabel('');
xlabel('');
hold on;
hplot = plot(xc,yc,'r:');
set(hplot,'YDataSource','yc');
set(hplot,'XDataSource','xc');
hold off;
hLambda = uicontrol('Style','slider','String','lambda','Value',.5,...
'Max',1,'Min',.01,'Callback',@lambdaCallback,'Units','normalized','Position',[.2 0.05 .6 .05]);
function lambdaCallback(hObject,eventdata)
lambda = get(hObject,'Value');
y = cos(2*pi*x/lambda);
yc = cos(2*pi*xc/lambda);
refreshdata(hplot,'caller');
refreshdata(hstem,'caller');
end
end