Hi,
One solution might be creating axes outside the function and pass them as parameters to the function.
Use hold on and plot on required axes.
For instance
f1 = figure;
ax1 = axes(f1) ;
f2 = figure;
ax2 = axes(f2) ;
hold(ax1,'on');
hold(ax2,'on');
syms g s z w
w1 = 4
z1 = 0.5
getAllInfo(w1,z1,ax1,ax2)
function getAllInfo(w,z,ax1,ax2)
num = [w^2]
den = [1 2*z*w w^2]
G = tf(num, den)
stepplot(ax1,G);
pzplot(ax2,G);
end
This will create all stepplots in one figure and pzplots in other one.
Hope this helps!