필터 지우기
필터 지우기

simple Equation, writing formula

조회 수: 4 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by