Effacer les filtres
Effacer les filtres

Change intensity of zplane figure

11 vues (au cours des 30 derniers jours)
Konstantinos
Konstantinos le 3 Nov 2023
Commenté : Konstantinos le 4 Nov 2023
Hello everyone,
I was trying to change the line-width of the zplane figure in order to make it more visible.I tried the set command but it didnt work.How can i fix it so it can work?
Thanks in advance.
This is my code so far:
function Lab2_Part_One
close all;
clearvars;
% Create directory if it doesn't exist
directory = 'Ask1';
if ~isfolder(directory) %For versions before R2017b use exist
% instead of is folder
mkdir(directory);
end
% Given transfer function
num = [0.2 0]; % Numerator coefficients
den = [1 -0.7 -0.18]; % Denominator coefficients
w = -pi:pi/128:pi; % Frequency range
% Function calls
plotPoleZeroPlot(num, den, directory);
end
function plotPoleZeroPlot(num, den, directory)
% Function to plot the pole-zero plot
figure;
h = zplane(num, den);
% Set the properties for poles (red lines)
set(h_poles, 'Color', 'green', 'LineWidth', 2); % Change color to green and line width
% Set the properties for zeros (blue lines)
set(h_zeros, 'Color', 'magenta', 'LineWidth', 1.5); % Change color to magenta and line width
% Redraw the unit circle with the desired linewidth
hold on;
t = 0:0.01:2 * pi; % Define points for the unit circle
plot(cos(t), sin(t), 'Color', [0 0.4470 0.7410], 'LineWidth', 1); % Plot the unit circle with the desired linewidth
%grid on;
title('Pole-Zero Plot of the Transfer Function H(z)');
% Save the pole-zero plot in the specified directory as a PNG file
filename = fullfile(directory, 'pole_zero_plot.png');
saveas(gcf, filename);
end

Réponse acceptée

Star Strider
Star Strider le 3 Nov 2023
Changing the properties requirees a bit of handle-spelunking, however it is possible.
Try this —
[z,p,k] = ellip(4,3,30,200/500);
figure
zplane(z,p)
grid
title('4th-Order Elliptic Lowpass Digital Filter')
figure
hzp = zplane(z,p);
grid
title('4th-Order Elliptic Lowpass Digital Filter')
getgca = get(gca);
Kids = getgca.Children;
Kids(2).Color = 'g';
Kids(2).LineWidth = 2;
Kids(3).Color = 'm';
Kids(3).LineWidth = 1.5;
% figure
% hold on
% plot(Kids(1).XData, Kids(1).YData, ':')
% plot(Kids(2).XData, Kids(2).YData, 'xg', 'LineWidth',2)
% plot(Kids(3).XData, Kids(3).YData, 'om', 'LineWidth',1.5)
% hold off
% axis([[-1 1]*1.5 [-1 1]*1.25])
% grid
The zplane function creates 3 different line objects, and once they are found, changing their properties is straightforward.
.
  7 commentaires
Star Strider
Star Strider le 4 Nov 2023
Thank you!
It is easier, however it appears that the line objects do not always appear in the same order, for whatever reason. If you want them to all be the same colours and sizes, the first solution is easier. If you want them to be specifically different, the strcmp approach is necessary. It all depends on what you want.
Konstantinos
Konstantinos le 4 Nov 2023
Thanks.I will keep in mind

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Performance dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by