Why should we write x(i,1)=cos(theta(1,i) in this format while using the for loop?
1 回表示 (過去 30 日間)
古いコメントを表示
採用された回答
KSSV
2021 年 8 月 17 日
編集済み: KSSV
2021 年 8 月 17 日
x = zeros(n+1,1) ;
for i=1:n+1
x(i)=R*cos(Theta_n(i)
You can very much write like you shown. But keep in mind that the variables should be vectors.
4 件のコメント
KSSV
2021 年 8 月 17 日
You can simply try and check the output your self.
When you try:
n = 3 ;
zeros(n+1)
You will get a matrix.
If you want to get a vector, you should specify:
n = 3 ;
zeros(n+1,1)
zeros(1,n+1)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!