Can my code be written like this?
2 ビュー (過去 30 日間)
古いコメントを表示
i want to write this formula as code in matlab,but i am not very sure that is my code right.
The range of j and k are both 1~K
for k= 1:K
for j=1:K
if k==j
a=mu(k).*( abs(h_(k)'*f_(k)^2 ) / hat_r(k);
else
b=mu(k).*( abs(h_(k)'*f_(j)^2 );
end
end
total=a+b;
end
回答 (1 件)
Jan
2019 年 1 月 31 日
編集済み: Jan
2019 年 1 月 31 日
There is no "hat_r(k)" in your formula. A trailing parenthesis is missing also.
total = 0;
hc = conj(h_);
for k = 1:K
c1 = ;
sumj = 0;
for j = 1:K
if j ~= k % [EDITED]
sumj = sumj + abs(hc(k) * f_(j)) ^ 2;
end
end
total = total + mu(k) * (abs(hc(k) * f_(k)) ^ 2 - sumj) / r_hat(k);
end
2 件のコメント
Jan
2019 年 1 月 31 日
編集済み: Jan
2019 年 1 月 31 日
If "it" should be "bar_r(k)", than simply insert this in my code. You do not have to wait until I do it. By the way, the character is a greek "gamma", not an "r". But names do not matter.
There is still a missing closing parenthesis. Please post a valid formula. A smaller zoom-level would be nice.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!