Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Bode plot using GUI

  1. Oct 15, 2011 #1
    Hello guys! I have an issue, i'm trying to make a program in which you can get a bode plot by knowing the transfer function in guide. The basic idea is this: you enter 4 numbers in the interface and by those numbers you can know the transfer function, basically i'm doing this as a final step:

    a = get(handles.T1_editText,'String');
    b = get(handles.T2_editText,'String');
    c = get(handles.T3_editText,'String');
    d = get(handles.T4_editText,'String');
    num=[a*b,a+b,1];
    den=[c*d,c+d,1];
    sys=tf(num,den);
    bode(sys)
    guidata(hObject, handles);

    I know there is something wrong with it, because i'm not getting the same plots i get in matlab to check the results (i write the transfer function in numbers). And another problem i have is that When i enter certain values I don't even get a plot and i get this message:

    ??? Error using ==> mtimes
    Inner matrix dimensions must agree.

    Error in ==> lol>Grafica_pushbutton_Callback at 213
    num=[a*b,b+a,1];

    Error in ==> gui_mainfcn at 96
    feval(varargin{:});

    Error in ==> lol at 42
    gui_mainfcn(gui_State, varargin{:});

    Error in ==> @(hObject,eventdata)lol('Grafica_pushbutton_Callback',hObject,eventdata,guidata(hObject))


    ??? Error while evaluating uicontrol Callback

    Which doesn't happen with different values.
    Oh and one more thing, when i get do get the plot, it's all over my GUI screen, and i can't even see, is there a way to plot it in a different window by using a command?

    I'll put up some images of what i'm talking about so you have a better idea.

    2ikxzp.png

    I'm kinda new to this MATLAB stuff, so try to bare with me :)
    Thanks in advance for your answers.
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted