フィルターのクリア

How can I take summation of the multiplication of the first and last matrix of for loop where the matrix values also change in a nested for loop?

1 回表示 (過去 30 日間)
The attached picture contains the equation that needs to be simulated. I guess it can be done using nested loop but unable to do so.
  1 件のコメント
Aastha Singla
Aastha Singla 2022 年 11 月 4 日
x matrix can be random 2nx1 matrix. I assumed it to be all zeros because it will update using this equation
x(:, j) = A*x(:,j) + B*u(k) where A and B are predefined matrixes and u(k) is and random PAM4 signal given as input

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

回答 (1 件)

Suvansh Arora
Suvansh Arora 2022 年 11 月 7 日
As far as I understand, you are facing issues with Matrix multiplication, where the matrix itself changes in each iteration. Please follow the code snippet below to get an idea of how you can achieve it.
n = 3
H = 0
for i=1:n
% Random generation of x
x = rand(2*n,1)
H = H + sum(x(i) * x(i+n)');
fprintf("%d * %d = %d", x(i), x(i+n), H);
end
H
In case of any difficulties with matrix multiplication, I would suggest you to take the MATLAB onramp course: MATLAB Onramp - MATLAB & Simulink Tutorial This would help you in understanding the essential MATLAB concepts.
I hope the above information helps you.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by