How can I implementation Array factor in matlab?

 採用された回答

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 11 日

0 投票

Hi,
In your exercise, you can use [for .. end] or [while ... end] loops with two nested iteration loops.
Good luck.

8 件のコメント

ANIKET CHAUHAN
ANIKET CHAUHAN 2019 年 10 月 12 日
編集済み: ANIKET CHAUHAN 2019 年 10 月 12 日
This is how i implemented ...any suggestion or correction?
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 12 日
You would need to change a little bit your code formulation:
[M, N] = size(phi); AF(1,1) = 0;
for m=1:M-1
for n = 1:N-1
AF(m+1,n+1) = AF(m,n)+ ..phi(m,n)..;
end
end
Good luck.
ANIKET CHAUHAN
ANIKET CHAUHAN 2019 年 10 月 12 日
編集済み: ANIKET CHAUHAN 2019 年 10 月 12 日
Hello..
I implemented as you said, If you think i implementing it in a wrong direction then correct me with right implementation.
By the way thank you for replying and correcting me though
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 13 日
編集済み: Sulaymon Eshkabilov 2019 年 10 月 13 日
Hi,
Based on my quick scan, you have employed [ ]. Use () instead of [ ]. Another point is in one point you have used (m,n) index for phi and in another you have missed the index (m,n).
Good luck.
ANIKET CHAUHAN
ANIKET CHAUHAN 2019 年 10 月 13 日
i have updated as you said ..is this look perfect now?
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 10 月 13 日
still, the index (m, n) are missing for phi() in two more places. Moreover, your given index for phi in one place (M, N) is not correct. Your nested loop works correctly only if you assign indices corrrectly. Pl., work on your indices carefully.
Good luck.
ANIKET CHAUHAN
ANIKET CHAUHAN 2019 年 10 月 13 日
[M,N] = size(phi) and phi(M,N) i have change this as [1,1] = size(phi) and inside the for loop phi(1,1)
but matlab shows an error "An array for multiple LHS assignment cannot contain M_NUMBER."
How can i assign value to [M,N] = size(phi) and phi(M,N) so my code works fine.
ANIKET CHAUHAN
ANIKET CHAUHAN 2019 年 10 月 14 日
is this changes are okay ?or i have to change indices again?

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by