# simple Equation, writing formula

1 view (last 30 days)
Maria Amr on 14 Jan 2021
Commented: Bobby Fischer on 14 Jan 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 CommentsShow 1 older commentHide 1 older comment
Maria Amr on 14 Jan 2021
Thank you!

Sign in to comment.

### Accepted Answer

Walter Roberson on 14 Jan 2021

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

##### 4 CommentsShow 3 older commentsHide 3 older comments
Bobby Fischer on 14 Jan 2021
Okay, now I understand.
Regards.

Sign in to comment.

### Categories

Find more on Matrix Indexing in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!