simple Equation, writing formula

7 visualizaciones (últimos 30 días)
Maria Amr
Maria Amr el 14 de En. de 2021
Comentada: Bobby Fischer el 14 de En. de 2021
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 comentarios
Bobby Fischer
Bobby Fischer el 14 de En. de 2021
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 el 14 de En. de 2021
Thank you!

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de En. de 2021

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

  4 comentarios
Maria Amr
Maria Amr el 14 de En. de 2021
Thank you!
Bobby Fischer
Bobby Fischer el 14 de En. de 2021
Okay, now I understand.
Regards.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices 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