simple Equation, writing formula

3 ビュー (過去 30 日間)
Maria Amr
Maria Amr 2021 年 1 月 14 日
コメント済み: Bobby Fischer 2021 年 1 月 14 日
I Truly appreciate if somebody check my code. I should measure a parameter of a long vector and I have wrtten the code but my prof. says it is something wrong. I am new in MATLAB:( .Thank you.
The equation is:
RC = ½(deltaVp/averageVp + deltaRHO/averageRHO). % reflection coefficients
My code is:
for j=2:l;
r2(j)=1/2.*((v(j)-v(j-1))/(v(j)+v(j-1))+(d(j)-d(j-1))/(d(j)+d(j-1))); % reflection coefficients
end
  2 件のコメント
Bobby Fischer
Bobby Fischer 2021 年 1 月 14 日
Hi, for the average of a vector shouldn't you use 'mean' or 'sum' and then divide by the length of the vector (number of elements)?
Maria Amr
Maria Amr 2021 年 1 月 14 日
Thank you!

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

採用された回答

Walter Roberson
Walter Roberson 2021 年 1 月 14 日

Average is sum divided by two. You do not divide by two.

  4 件のコメント
Maria Amr
Maria Amr 2021 年 1 月 14 日
Thank you!
Bobby Fischer
Bobby Fischer 2021 年 1 月 14 日
Okay, now I understand.
Regards.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by