Borrar filtros
Borrar filtros

How to choose a value from the plot?

1 visualización (últimos 30 días)
Priya
Priya el 23 de Mayo de 2014
Editada: Priya el 6 de Ag. de 2014
plot(contact_geometry.y-d,contact_geometry.r_L)
Could someone please tell me, is it possible to do coding in such a way that one random value of Y is chosen for each iteration automatically.
For eg, when I run the program for the first time, R should be 0.4494, next time 0.4657. And this should rely on the above plot command. Please help.

Respuesta aceptada

Star Strider
Star Strider el 23 de Mayo de 2014
Not certain what you want, so here are two possibilities:
For any y on the domain (-0.03, 0.01):
f = @(x) 1./(1-75*x); % Substitute your function
x = 0.04*rand-0.03; % Define domain
y = f(x); % Calculate ‘y’
For your particular three values:
v = [0.4494 0.4542 0.4657];
y = v(randi(3)); % Randomly choose one
  27 comentarios
Priya
Priya el 6 de Jun. de 2014
Perfect! Thanks once again.
Star Strider
Star Strider el 6 de Jun. de 2014
Again, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by