function mornig
A = 0; F = 0; T = 0;
N=500;
M=300;
handles.fig=figure;
mpos = get(handles.fig,'position');
set(handles.fig, 'position',[mpos(3) mpos(4) N M]);
handles.axes = axes();
set(handles.fig,'unit','pixels');
set(handles.axes,'unit','pixels');
handles.edit1 = uicontrol('style','edit');
set(handles.edit1,'position',[N-360 0 120 20]);
set(handles.edit1,'string','A');
set(handles.edit1,'horizontalalignment','center');
handles.edit2 = uicontrol('style','edit');
set(handles.edit2,'position',[N-240 0 120 20]);
set(handles.edit2,'string','F');
set(handles.edit2,'horizontalalignment','center');
handles.edit3 = uicontrol('style','edit');
set(handles.edit3,'position',[N-120 0 120 20]);
set(handles.edit3,'string','T');
set(handles.edit3,'horizontalalignment','center');
set(handles.edit1, 'callback', @edit_callback1);
set(handles.edit2, 'callback', @edit_callback2);
set(handles.edit3, 'callback', @edit_callback3);
function edit_callback1(src, event_data)
A = str2double( get(src, 'String') );
end
function edit_callback2(src, event_data)
F = str2double( get(src, 'String') );
end
function edit_callback3(src, event_data)
T = str2num( get(src, 'String') );
plot(handles.axes, T, A*cos(2*pi*F*T));
end
Best Answer