Zooming a portion of figure in a figure
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Marie Pettersen
el 25 de Oct. de 2019
Comentada: Marie Pettersen
el 25 de Oct. de 2019
Hi, i want to zoom in on a portion of this figure. It is a plot of eigenvalues, and I want to show a zoomed figure of the eigenvalues close to real axis equal zero. As you can see I have tried my best at the end, but it doesn't work. Can anyone help?
close all
L = 0.01;
R = 0.1;
K_i = 800;
K_p = [0.8, 1.2, 2, 4, 10, 40, 100];
figure;
for i=1:length(K_p)
A = [0 -K_i ; 1/L -(R+K_p(i))/L];
z = eig(A);
a = real(z);
b = imag(z);
txt = ['Kp = ', num2str(K_p(i))];
plot(a, b, 'o', 'DisplayName',txt)
hold on
legendnames(i) = K_p(i);
end
hold off
grid on
legend('Location','northwest')
legend show
xlabel('Real axis'),ylabel('Imaginary axis')
xlim([-10500 100])
ylim([-300 300])
axes('position', [0.2 0.2 0.25 0.25])
box on
your_index = -1000 < a & 100 > a;
plot(a(your_index), b(your_index));
axis tight
0 comentarios
Respuesta aceptada
Daniel M
el 25 de Oct. de 2019
Editada: Daniel M
el 25 de Oct. de 2019
I just made some minor adjustments
close all
L = 0.01;
R = 0.1;
K_i = 800;
K_p = [0.8, 1.2, 2, 4, 10, 40, 100];
figure('Position',[52 237 890 659]);
for i=1:length(K_p)
A = [0 -K_i ; 1/L -(R+K_p(i))/L];
z = eig(A);
a = real(z);
b = imag(z);
txt = ['Kp = ', num2str(K_p(i))];
plot(a, b, 'o', 'DisplayName',txt)
hold on
legendnames(i) = K_p(i);
end
g = get(gca);
pt = 7;
colorOfPoint = g.ColorOrder(pt,:);
% this get the color of the point "pt"
hold off
grid on
legend('Location','northwest')
legend show
xlabel('Real axis'),ylabel('Imaginary axis')
xlim([-10500 100])
ylim([-300 300])
axes('position', [0.2 0.2 0.25 0.25])
box on
your_index = -1000 < a & 100 > a;
plot(a(your_index), b(your_index),'o','MarkerSize',10,'Color',colorOfPoint);
axis tight
grid on
ann1 = annotation('textbox', 'Units','pixels',...
'Position',[198 109 203 76], ...
'String', 'Kp = 100', ...
'EdgeColor', 'none', ...
'FontSize', 12, ...
'FontName', 'Helvetica');
3 comentarios
Daniel M
el 25 de Oct. de 2019
Yes it's possible, just make an array that contains all those points, and plot them. Although, they are kind of spread apart, I don't really see how the inset picture will be better than your main figure.
Más respuestas (0)
Ver también
Categorías
Más información sobre Graphics Object Programming en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!