Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: multiple plots in same axes of a matlab gui, (MCCabe Thiele Method for binary distillation)
Replies: 1   Last Post: Feb 23, 2014 11:30 AM

 Messages: [ Previous | Next ]
 Jigar Parekh Posts: 1 Registered: 2/23/14
multiple plots in same axes of a matlab gui, (MCCabe Thiele Method for binary distillation)
Posted: Feb 23, 2014 10:28 AM

Hello,
I am trying to develop a GUI to find out the no of stages in a binary distillation through McCabe Thiele Method. I wish to plot more than two plots (for every loop cycle) in the same axes of my Matlab GUI. Moreover, I want none of them to be replaced by the preceding one. I tried but only the first two plots are visible. Below is the code which will make my query much clear. (Axes tag: stages)

%% loop 1 for no_of_stages
set(handles.stages,'NextPlot','Replacechildren')
Frames=getframe;
pause(1.5)
title(handles.stages,'McCabe-Thiele Method - No of stages')
xlabel(handles.stages,'x'),ylabel(handles.stages,'y'), axis(handles.stages,[0 1 0 1]),
axis(handles.stages,'square')
fplot(handles.stages,@(x) alpha*x./(1+x.*(alpha-1)), [0 1]);grid on; % eqb curve
Frames=getframe;
pause(1.5) %%******It works till this line****%%

set(handles.stages,line([0 1],[0 1]),line([xf xq],[xf yq]),line([xd xq],[xd yq]),'color','black') % x=y line
Frames=getframe;
pause(1)
set(handles.stages,line([xf xq],[xf yq]),'color','black') %q line
Frames=getframe;
pause(1)
set(handles.stages,line([xd xq],[xd yq]),'color','red') %rect line
Frames=getframe;
pause(1)
set(handles.stages,line([xb xq],[xb yq]),'color','red') %strip line
Frames=getframe;
pause(1)
y=xd;
x=xd;
no_of_stages=0;
feed_stage=0;

while(x>xb)
t=x;
u=y;
x=y/(alpha-(alpha-1)*y); %eqb line
if(x>xq)
y=(R/(R+1))*x+xd/(R+1); % rect line
feed_stage=feed_stage + 1;
else
y=(1+1/Rb)*x-xb/Rb; % strip line
end
no_of_stages=no_of_stages+1; % count
delta=t-x;
set(handles.stages,line([t x],[u u]),'color','blue','LineWidth',1.5) %stages
set(handles.stages,line([x x],[u y]),'color','blue','LineWidth',1.5) %stages
Frames=getframe;
pause(0.25);
end
movie (Frames)

Kindly, let me know some remedy to my problem. If needed, I can mail you the .m file.

Date Subject Author
2/23/14 Jigar Parekh
2/23/14 dpb