(adsbygoogle = window.adsbygoogle || []).push({}); MATLAB : Step Plots [Urgent]

I am stuck at very crucial stage. I want to generate the step plot which is generated usingstepcommand in simple MATLAB environment. However, I am trying to incorporate it in GUI where it should plot the step plot when clicked on the button.

Following is the code for writing in normal MATLAB environment i.e. without GUI :-

Taken from http://www.engin.umich.edu/class/ctms/examples/cruise/ccpid.htm"Code (Text):m=1000;

b=50;

num=[1];

den=[m b];

cruise=tf(num,den);

Kp = 600;

Ki = 1;

contr=tf([Kp Ki],[1 0]);

sys_cl=feedback(contr*cruise,1);

u=10;

t=0:0.1:20;

step(u*sys_cl,t)

axis([0 20 0 10])

I am trying to put the same thing under the button callback and it just doesnt show on the axes I have made. The axes just disappear and nothing happens. However, the simpleplotcommand works all right.

Following is my MATLAB code :-

So how do I plot the unit step plot on those axis ? Is there someway to plot theCode (Text):function pushbutton1_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

axes(handles.axes1)

k=get(handles.edit1,'String');

Kp=str2num(k);

m=1000;

b=50;

u=10;

num=[1];

den=[m b];

cruise=tf(num,den);

sys_cl=feedback(Kp*cruise,1);

t=0:0.1:20;

step(u*sys_cl,t);

guidata(hObject, handles);stepfunction usingplot?

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB : Step Plots

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - MATLAB Step Plots | Date |
---|---|

Matlab Split-step Fourier method | Apr 4, 2016 |

Help: MATLAB time step function | Jan 11, 2015 |

Step function using matlab | Feb 5, 2012 |

MATLAB changing axis labes on step()/margin() functions help required please | Oct 27, 2011 |

Need help graphing a step function within Matlab | Aug 29, 2011 |

**Physics Forums - The Fusion of Science and Community**