My equation gives only one value for 1x200 vector variables

8 ビュー (過去 30 日間)
Hyesun Cha
Hyesun Cha 2015 年 2 月 8 日
コメント済み: Hyesun Cha 2015 年 2 月 8 日
%Initial Values and Constants n_i = 1; n_t = 1.33; theta_i = linspace(0,pi/2,200); theta_t = asin(n_i/n_t*sin(theta_i));
%Calculate results R_p = ((n_t*cos(theta_i)-cos(theta_t))/(cos(theta_t)+n_t*cos(theta_i)))^2;
My equation R_p give one single value of 0.0029. I want to plot this function for theta_i, but I can't. What should I do?

採用された回答

Erik S.
Erik S. 2015 年 2 月 8 日
Hi
You forgot the . symbol when doing elementwise operations. Try this instead:
R_p = ((n_t*cos(theta_i)-cos(theta_t))./(cos(theta_t)+n_t*cos(theta_i))).^2;

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by