Plotting Fresnel reflection plotting

7 ビュー (過去 30 日間)
Peter
Peter 2013 年 11 月 15 日
編集済み: Walter Roberson 2016 年 11 月 19 日
Hi,
I'm new to MATLAB and I tried plotting the formula for the fresnel reflection:
R=(n_S-1)^2/(n_S+1)^2.
Here's what I did:
n_S = 1:.1:3.5;
R=((n_S-1).^2)/((n_S+1).^2);
Unfortunately that gave me a number as answer (0.2235) and not the 26-Element Array I was expecting. I also tried calculating both the upper and lower part of the quotient separately. Both gave me an Array, but when I calculated R=R_upper/R_lower I still got 0.2235.
Can anyone please tell me, what I am doing wrong?
Thanks in advance for your help.

採用された回答

Ben Southwell
Ben Southwell 2016 年 11 月 19 日
If anyone needs to know the answer to this. It is because he is not doing element wise division
R=((n_S-1).^2)/((n_S+1).^2);
should be
R=((n_S-1).^2)./((n_S+1).^2);
Note the './' instead of '/' for division

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by