![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/893165/image.png)
How to make the zplane function to plot on a existing axes?
22 views (last 30 days)
Show older comments
The zplane function always create a new plot. HOW to let it on a exisiting axes? Or any workaround?
0 Comments
Accepted Answer
Paul
on 13 Feb 2022
Edited: Paul
on 13 Feb 2022
You can specify an existing axis via a third argument. I didn't see this on the doc page, but it does show up in the help,
help zplane
The following code works fine on my local installation. It results in a figure with three lines and the zplane pole/zero plot..Don't know why it's not working here?
figure;
rng(101);
plot(rand(3));
hax = gca;
zplane([1 2 3],[3 2 1],hax)
Here is the figure I get on my machine:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/893165/image.png)
2 Comments
Paul
on 14 Feb 2022
There should be link or something similar at the bottom of the doc page that allows you to provide feedback on a doc page if you wish.
More Answers (1)
Voss
on 13 Feb 2022
Edited: Voss
on 13 Feb 2022
I don't think you can do that with zplane(), but you can, in your own axes, fairly easily reproduce the lines that zplane() creates:
% First a zplane plot for reference:
[b,a] = ellip(4,3,30,200/500);
zplane(b,a);
% Now a new figure and axes with some stuff in it:
figure();
plot(linspace(-1,1,10),linspace(-1,1,10),'rs','LineWidth',2);
hold on
% Now, plotting what zplane(b,a) would plot:
axis equal
z = roots(b);
p = roots(a);
t = linspace(0,2*pi,1000);
blue = [0 0.447 0.741];
xl = get(gca(),'XLim');
yl = get(gca(),'YLim');
line(xl,[0 0],'Color',blue,'LineStyle',':','LineWidth',0.5);
line([0 0],yl,'Color',blue,'LineStyle',':','LineWidth',0.5);
line(cos(t),sin(t),'Color',blue,'LineStyle',':','LineWidth',0.5);
line(real(z),imag(z),'Color',blue,'LineStyle','none','Marker','o','MarkerSize',7);
line(real(p),imag(p),'Color',blue,'LineStyle','none','Marker','x','MarkerSize',8);
xlabel('Real Part');
ylabel('Imaginary Part');
See Also
Categories
Find more on Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!