??? Subscript indices must either be real positive integers or logicals.

1 回表示 (過去 30 日間)
Brenden
Brenden 2011 年 6 月 27 日
clear all
close all
d=[0.7, 2, 23.3];
n=[1.5, 1.33, 1.00];
theta= zeros(length(d));
theta(1)= pi/6;
for ii=1:(length(d)-1);
asin(n(ii)*sin(theta(ii))/n(ii+1))= theta(ii+1);
end
h= zeros(length(d));
for jj=1:length(d);
h(jj)= tan(theta(jj))* d(jj);
end
sum(h)
??? Subscript indices must either be real positive integers or logicals.
Error in ==> Untitled at 11 asin(n(ii)*sin(theta(ii))/n(ii+1))= theta(ii+1)
im not sure how to fix this simple code.. please help thanks BN

採用された回答

Sean de Wolski
Sean de Wolski 2011 年 6 月 27 日
I think you have theta and asin reversed in the first for-loop
theta(..) = asin(..)
  1 件のコメント
Brenden
Brenden 2011 年 6 月 27 日
haha thanks.. its always a stupid thing

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by