Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
I'm trying to figure out how to plot how the gain of a system (k) changes within the interval of -5 to 20 incrementing by 0.5. The code I have so far is below. I'm pretty sure I must be close. The 1 and 10 are given for the q values.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
figure (4)
hold on
q=[1 10 i];
for i=-5:0.5:20
end
p2=roots(q);
plot(real(p2), imag(p2), 'rx')
line([0,0], [-6,6])
line([-12,1], [0,0])
xlabel('Real Axis'), ylabel('Imaginary Axis')
title('k= -5<k<20');
0 comentarios
Respuestas (1)
Image Analyst
el 3 de Sept. de 2014
Well you need to have something inside the for loop of course. Yours is empty! Do you think may lines like the q and p2 lines, and others, might go inside the loop???
2 comentarios
Image Analyst
el 3 de Sept. de 2014
You can't have negative indexes of an array. Just have p2 and it will put all the roots into an array called p2. Then you don't want the (m) in the plot statement either. Then you need to have "hold on" after the plot or else new plots will blow away old ones so fast you won't even see them. If you have "hold on" then it will keep all the plots on the graph.
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!