フィルターのクリア

Can anybody help on this FOR loops

2 ビュー (過去 30 日間)
Murad Nuri
Murad Nuri 2020 年 6 月 5 日
回答済み: madhan ravi 2020 年 6 月 5 日
I do not really understand what exactly is wrong here.
I want to have the following variables give seperate results for each n.
Can you help me correct this?
for n = 1:N
Ln(n)=V(1:N,n)'*M*l
Mn(n)=V(1:N,n)'*M*V(1:N,n)
Gamma_n(n)=Ln/Mn
Mn_star(n)=Ln^2/Mn
fn_st(n)=Gamma_n.*M*V(1:N,n)
end
  2 件のコメント
madhan ravi
madhan ravi 2020 年 6 月 5 日
Does all the variables return a scalar in each iteration?
Murad Nuri
Murad Nuri 2020 年 6 月 5 日
It does. But after each step of n, the previous value for the variable vanishes, this is not i want to have. I want for n=1 to have Ln(1), etc, for n=2 Ln(2), etc...

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

採用された回答

madhan ravi
madhan ravi 2020 年 6 月 5 日
[Ln, Mn, Gamma_n, Mn_star, fn_st] = zeros(N,1);
for n = 1:N
Ln(n)=V(1:N,n)'*M*l;
Mn(n)=V(1:N,n)'*M*V(1:N,n);
Gamma_n(n)=Ln(n)/Mn;
Mn_star(n)=Ln(n)^2/Mn;
fn_st(n)=Gamma_n(n).*M*V(1:N,n);
end

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by