Summation In Matlab With Vectors

1 回表示 (過去 30 日間)
Irem Sara
Irem Sara 2022 年 2 月 14 日
コメント済み: Irem Sara 2022 年 2 月 17 日
I am trying to compute a summation over 1:N, and the expression is below:
I already defined the vectors = s11 and = smat and $Y_{dt}= Yd;
Any help would be appreciated! Thanks a lot
  2 件のコメント
Simon Dengler
Simon Dengler 2022 年 2 月 14 日
maby this helps: https://de.mathworks.com/help/matlab/ref/sum.html
Irem Sara
Irem Sara 2022 年 2 月 14 日
編集済み: Irem Sara 2022 年 2 月 14 日
I am not sure if the latex code was showing, but the issue is I tried using the below code:
I get an error "Array indices must be positive integers or logical values." And I am not sure if the code is what is described in the summation.
for i=1:N
chi(i,1)= sum(beta^(i+1)*gamma/s11(i,1) *(840*(1+eta)*exp(xi*Yd(i,1)-(1+eta)*smat(i,1))/(1+exp(xi*Yd(i,1)-(1+eta)*smat(i,1))))^(i-1));
end

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

回答 (1 件)

David Hill
David Hill 2022 年 2 月 14 日
No loop needed. Need to examine each array (s11,Yd,smat) and ensure they have the necessary elements (at least N). Recommend not using 'i' to index (something it can be confused for complex number).
I=(1:N)';
chi(I,1)= sum(beta.^(I+1)*gamma./s11(I,1).*(840*(1+eta)*exp(xi*Yd(I,1)-(1+eta)*smat(I,1))./...
(1+exp(xi*Yd(I,1)-(1+eta)*smat(I,1)).^2)).^(I-1));%did not square the exp term in denominator
  3 件のコメント
David Hill
David Hill 2022 年 2 月 14 日
Please attach all your variables and I will take a look.
Irem Sara
Irem Sara 2022 年 2 月 17 日
This actually worked in the end! Thank you very much- your response was super helpful

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by