How to define a continuous range?

34 visualizaciones (últimos 30 días)
Yuhong Jin
Yuhong Jin el 27 de Nov. de 2019
Respondida: Chidvi Modala el 3 de En. de 2020
Here I defined a range for dy from 0.5 to 5 using
dy = 0.5:0.1:5
The script works slowly and need to wait for a long time for it to produce a graph
If I used another way like below trying to define a continuous range:
dy >=0.5 & dy <=5
or
dy >=0.5 && dy <=5
Matlab produces errors saying
Invalid use of operator.
My full script is below:
syms x1 y1 x2 y2
i=1;
for dy=0.5:0.1:5
M(i,1) = dy;
f = [5.*x1-6.*y1+1+0.5.*(x2-x1), 6.*x1-7.*y1+1+dy.*(y2-y1), 5.*x2-6.*y2+1+0.5.*(x1-x2), 6.*x2-7.*y2+1+dy.*(y1-y2)];
v = [x1,y1,x2,y2];
R0 = jacobian(f,v);
d0 = eig(R0);
dmax = [max(d0)]
M(i,2) = dmax;
i = i+1;
end
plot(M(:,1),M(:,2))
What should I do if I want to define a continuous range and improve the working speed of the script?
Thanks in advance.

Respuestas (1)

Chidvi Modala
Chidvi Modala el 3 de En. de 2020
If you can provide the time it is taking to plot the graph by using tic and toc, it will be helpful. Because it is taking just 3s for me to run the entire script.

Categorías

Más información sobre Directed Graphs 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!

Translated by