how to mark a given point on the graph?
Show older comments
ti = 0;
tf = 1E-3;
tspan=[ti tf];
KC = 4E-3;
y0= [ (10e-6)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1));
(10e-6)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1));
(10e-6)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1));
(10e-6)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1));
(10e-6)*rand(2,1); ((-3.14).*rand(1,1) + (3.14).*rand(1,1));
((-3.14).*rand(5,1) + (3.14).*rand(5,1))];
yita_mn = [
0 1 0 0 1;
1 0 1 0 0;
0 1 0 1 0;
0 0 1 0 1;
1 0 0 1 0;
]*(KC);
N = 5;
t = 1E-3;
o = sort(10e2*rand(1,10),'ascend');
[T,Y]= ode45(@(t,y) rate_eq(t,y,yita_mn,N,o),tspan,y0);
figure(1)
plot(Y(:,1),(Y(:,2)),'linewidth',2);
% i want to mark in y axis 3.57832 and in x axis 0.092
xlabel("Gain")
ylabel("Amplitude")
grid on
set(gca,'fontname','times New Roman','fontsize',18,'linewidth',1.8);
function dy = rate_eq(t,y,yita_mn,N,o)
dy = zeros(4*N,1);
dGdt = zeros(N,1);
dAdt = zeros(N,1);
dOdt = zeros(N,1);
P = 1.27;
a = 0.1;
tc = 230E-6;
tp = 5.4E-9;
Gt = y(1:3:3*N-2);
At = y(2:3:3*N-1);
Ot = y(3:3:3*N-0);
k = 4E-3;
for i = 1:N
dGdt(i) = (P - Gt(i).*((abs(At(i)))^2 +1))./tc ;
dAdt(i) = (Gt(i)-a).*((At(i))./tp);
dOdt(i) = o(1,i);
for j = 1:N
dAdt(i) = dAdt(i)+yita_mn(i,j)*(1/tp)*(At(j))*cos(Ot(j)-Ot(i));
dOdt(i) = dOdt(i)+yita_mn(i,j)*(1/tp)*((At(j)/At(i)))*sin(Ot(j)-Ot(i));
end
end
dy(1:3:3*N-2) = dGdt;
dy(2:3:3*N-1) = dAdt;
dy(3:3:3*N-0) = dOdt;
n1 = (1:5)';
n2 = circshift(n1,-1);
n16 = n1 + 15;
n17 = circshift(n16,-1);
n20 = circshift(n16,1);
j2 = 3*(1:5)-1;
j5 = circshift(j2,-1);
j8 = circshift(j2,-2);
j19 = circshift(j2,1);
dy(n16) = o(1,n2).' - o(1,n1).' - (k./tp).*(y(j2)./y(j5)).*sin(y(n16)) - (k./tp).*(y( j5)./y(j2)).*sin(y(n16)) + (k./tp).*(y(j8)./y(j5)).*sin(y(n17)) + (k./tp).*(y(j19)./y(j2)).*sin(y(n20));
end
3 Comments
Star Strider
on 9 Oct 2022
After the plot call in figure(1), add:
hold on
plot(3.57832, 0.092, 'xr') % i want to mark in y axis 3.57832 and in x axis 0.092
hold off
However that is not anywhere near the plotted lines.
Be certain that you have the value correct for the x-coordinate (3.57832).
dpb
on 9 Oct 2022
"i want to mark in y axis 3.57832 and in x axis 0.092"
That's in the edge of the dark blob where line space is so close as to be indistinguishable, but definitely in the ROI.
You swapped x,y, Star... :)
hXY=plot(0.092,3.57832,'xr');
where saved a handle to the specific point/line so can delete/recreate/modify at will more easily...
SAHIL SAHOO
on 10 Oct 2022
Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!