I'm creating a GUI that plots a Bode Plot from an entering data. I have the following code but it's giving me an error that I don't understand.
function first_gui
%This gui plots a bode plot from a
%a Transfer function generated from the main plot
%Create a figure with the plot and others pushbutons
f = figure('Visible','on','Position',[360,500,600,400]);
hplot = uicontrol('Style','pushbutton','String','Plot','Position',[415,200,70,25],'Callback',@tf_Callback);
%Create an entering data to numerator
htext = uicontrol('Style','text','String','Entre com a função de transferência','Position',[320,350,250,15]);
hnum = uicontrol(f,'Style','edit','String','Enter TF numerator...','Position',[320,320,250,20]);
%Create an entering data to denominator
htext_2 = uicontrol('Style','text','String','Entre com a função de transferência','Position',[320,280,250,15]);
hden = uicontrol(f,'Style','edit','String','Enter TF denominator...','Position',[320,250,250,20]);
hfig = axes('Units','pixels','Position',[50,60,200,185]);
%Initialize the UI
f.Units = 'normalized';
hfig.Units = 'normalized';
hplot.Units = 'normalized';
hnum.Units = 'normalized';
hden.Units = 'normalized';
sys = tf(hnum,hden);
f.Name = 'Bode Plot';
%Function to plot Bode
function tf_Callback(source,eventdata)
bode(sys)
end
end
There're appearing these errors on IDLE:
Error using tf (line 279) Invalid syntax for the "tf" command. Type "help tf" for more information.
Error in Simple_Plot (line 29) sys = tf(hnum,hden);
Undefined function or variable "sys".
Error in Simple_Plot/tf_Callback (line 36) bode(sys)
Error while evaluating uicontrol Callback