How to define line colour in zplane plotting

23 visualizzazioni (ultimi 30 giorni)
I have used the command; zplane to plot a graph and i wanted to change the line colour but still i am struggling...... if someone know how to do this please let me know!!!
Thank you, Ishan

Risposta accettata

Babarandage Perera
Babarandage Perera il 22 Apr 2011
Thank you Walter Roberson and Matt Fig !!!
Walter I tried your code but it plots unit circle red and y axis green. since I wanted to plot zeros and poles in colours,I manage to modify the your code as;
figure(2) % Z-plane poles and zeors
[hz1, hp1, ht1] = zplane(a,b); % Plot zeros and poles when coefficients are unquantized
grid on;% turn on grids
hold on;% Plot the second graph in same figure
[hz2, hp2, ht2] = zplane(H_Ka,H_Kb);%Plot zeros and poles when coefficients unquantized
hold off;
set(findobj(hz1, 'Type', 'line'), 'Color', 'g');
set(findobj(hp1, 'Type', 'line'), 'Color', 'g');
set(findobj(hz2, 'Type', 'line'), 'Color', 'r');
set(findobj(hp2, 'Type', 'line'), 'Color', 'r');
Thank you again Walter !! Cheers !!!

Più risposte (4)

Walter Roberson
Walter Roberson il 6 Apr 2011
[hz,hp,ht] = zplane(...);
set(findobj(ht, 'Type', 'line'), 'Color', NewColor);
  2 Commenti
Babarandage Perera
Babarandage Perera il 21 Apr 2011
first of all thank you again for your help
I am using z-plane command in following code. What i am trying to do is plot two results (poles and zeros)in one figure. But to distinguish thos two results( poles & zeros of quantized coefficients and poles and zeros of unquantized coefficients)i have to use two colours. Can you help????
figure(2) % Z-plane poles and zeors
zplane(a,b); % Plot zeros and poles when coefficients are unquantized
grid on;% turn on grids
hold on;% Plot the second graph in same figure
zplane(H_Ka,H_Kb);%Plot zeros and poles when coefficients unquantized
hold off;
Walter Roberson
Walter Roberson il 21 Apr 2011
Modificato: Walter Roberson il 16 Set 2020
figure(2) % Z-plane poles and zeors
[hz1, hp1, ht1] = zplane(a,b); % Plot zeros and poles when coefficients are unquantized
grid on;% turn on grids
hold on;% Plot the second graph in same figure
[hz2, hp2, ht2] = zplane(H_Ka,H_Kb);%Plot zeros and poles when coefficients unquantized
hold off;
set(findobj(ht1, 'Type', 'line'), 'Color', 'r'));
set(findobj(ht2, 'Type', 'line'), 'Color', 'g'));

Accedi per commentare.


Matt Fig
Matt Fig il 21 Apr 2011
To change the color of the lines easily with a mouse click, you could use LINECMENU.

Andrei Prikhod'ko
Andrei Prikhod'ko il 22 Ott 2016
Walter forever!!!

Hansamal Dharmananda
Hansamal Dharmananda il 16 Set 2020
clc; clear;close all;
%%
%%%%%%%% a) b) %%%%%%%%%
B=[1 2 -1]; %numerator coeffients
A=[1 -1 0.5]; %denominator coeffients
Zeros=roots(B); %numerator
Poles=roots(A); %denominator
[hz1, hp1, ht1] = zplane(B,A);%with the unit circle
set(findobj(hz1, 'Type', 'line'), 'Color', 'b');
set(findobj(hp1, 'Type', 'line'), 'Color', 'g');
set(findobj(ht1, 'Type', 'line'), 'Color', 'r');
% H = tf(B,A); %set the transferfunction
% pzmap(H) % without the unit circle
title('Pole-zero map')
axis([-3 1.2 -1.2 1.2]);

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by