フィルターのクリア

How can I write the code of this line ?

2 ビュー (過去 30 日間)
Zeinab Ahmadi93
Zeinab Ahmadi93 2017 年 7 月 26 日
コメント済み: Walter Roberson 2017 年 7 月 26 日
Hello
E_PI=sqrt((xm-x_I)^2+(ym-y_I)^2);
E_PZ=sqrt((xm-xr)^2+(ym-yr)^2);
E_BZ= sqrt((x1(index1)-xr)^2+(y1(index1)-yr)^2);
r_1=E_BZ+E_PI;
r_2=E_BZ-E_PZ;
Assume that I have r1 and r2 and n=100, How can I write the following line which runs.Thanks in advance:)
  2 件のコメント
Walter Roberson
Walter Roberson 2017 年 7 月 26 日
For the above purpose, how is rand(k,1) defined?
Walter Roberson
Walter Roberson 2017 年 7 月 26 日
The code looks like it is intended to generate n random values in the range r1 to r2. If so then
R = (r1 - r1) * rand(n, 1) + r1;

サインインしてコメントする。

回答 (1 件)

Kambren Rowlan
Kambren Rowlan 2017 年 7 月 26 日
Maybe?
% code
n = 100;
for j = 1:n
R(j) = r2 - r1)*(randi([1 j],1,1) + r1);
end
  2 件のコメント
Zeinab Ahmadi93
Zeinab Ahmadi93 2017 年 7 月 26 日
Thanks for your reply (randi([1 j],1,1) or (randi([1 j],1)?
Walter Roberson
Walter Roberson 2017 年 7 月 26 日
I do not understand why randi is being used here?

サインインしてコメントする。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by