Plot using '-' and '--' in a for loop of calculations

1 Ansicht (letzte 30 Tage)
uri iger
uri iger am 12 Nov. 2017
Kommentiert: uri iger am 13 Nov. 2017
syms x
a = -0.25:0.001:0.25
c = a.^2
figure;
hold on
for b = 1:500
d = 100+c(b)
g = (100-c(b))
y1 = 10+i*0.05+sqrt(c(b)-0.0001);
y2 = 10+i*0.05-sqrt(c(b)-0.0001);
sol = vpasolve( x^4 - 0.2*i*(x^3) - (2*d+0.0099)*(x^2) + 0.2*i*d*x + g^2 == 0 , x )
plot(real(vpa(sol(3))),imag(vpa(sol(3))),'r.',real(vpa(sol(4))),imag(vpa(sol(4))),'r.')
plot(real(y1),imag(y1),'b.',real(y2),imag(y2),'b.')
end
hold off
Can plot only using 'color.' with single points. i want the plotting of sol() to be solid (between each others points), and the y1 and y2 to plot using dashed line.
thanks a lot in advance
Uri

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Nov. 2017
That is not possible, except by post-processing to locate all of the plot handles and using their relative positions in the axes Children to figure out which of the two lines they belong to, and then construct new lines joining them together.
What you should be doing is recording the values inside the loop instead of plotting inside the loop, and then doing the plotting as a whole afterwards.
  1 Kommentar
uri iger
uri iger am 13 Nov. 2017
thanks! how do i do that, and then plot the actual lines? couldnt manage that, that's why I'm in this problem from the start.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by