How to choose a value from the plot?

조회 수: 5 (최근 30일)
Priya
Priya 2014년 5월 23일
편집: Priya 2014년 8월 6일
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.

채택된 답변

Star Strider
Star Strider 2014년 5월 23일
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
Priya
Priya 2014년 6월 6일
Perfect! Thanks once again.
Star Strider
Star Strider 2014년 6월 6일
Again, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Probability Distributions and Hypothesis Tests에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by