Register to reply

MATLAB : Step Plots

by Altairs
Tags: matlab, plots, step, urgent
Share this thread:
Altairs
#1
May28-09, 12:13 PM
P: 127
I am stuck at very crucial stage. I want to generate the step plot which is generated using step command 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 :-

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])
Taken from http://www.engin.umich.edu/class/ctm...uise/ccpid.htm

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 simple plot command works all right.

Following is my MATLAB code :-

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);
So how do I plot the unit step plot on those axis ? Is there someway to plot the step function using plot ?
Phys.Org News Partner Science news on Phys.org
New model helps explain how provisions promote or reduce wildlife disease
Stress can make hard-working mongooses less likely to help in the future
Grammatical habits in written English reveal linguistic features of non-native speakers' languages

Register to reply

Related Discussions
Colors in matlab plots Math & Science Software 1
MATLAB and contour plots Math & Science Software 0
Importing MATLAB Plots into MATHCAD Math & Science Software 0
Help with Matlab plots Math & Science Software 3
Sensitivity Plots in MATLAB Math & Science Software 2