How can i create for loop on SIMULINK?

6 ビュー (過去 30 日間)
Yanderella Korolva
Yanderella Korolva 2019 年 2 月 26 日
回答済み: Mohammad Hukan 2019 年 3 月 6 日
Hi,
I should create a matrix with using V and G. Each G values can be multiply with each V values and finally the matrix should be created as 7x20.
For ex. [7.03*10 7. 03*11 7.03*12 ...
...
[1.4*10 1.4*11 1.4*12...
...
I have a new SIMULINK user. I am be able to create for loop on MATLAB, but i need to help for doing of this operation on SIMULINK.
can you help me?
Thanks a lot!
Note: My model at the attachment.
  2 件のコメント
Mohammad Hukan
Mohammad Hukan 2019 年 2 月 26 日
I'm sorry but I didn't understand what you want to achieve! you have two vectros and want to multiply them element by element to get a matrix? if that's the case then why use a loop? you won't need a loop to do so!
Yanderella Korolva
Yanderella Korolva 2019 年 2 月 26 日
You have understood correctly. :)
Yes, this operation can be do with matrix multiplication. But, i want to create for loop and get same resuts.

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

回答 (1 件)

Mohammad Hukan
Mohammad Hukan 2019 年 3 月 6 日
well if you want to do it with a loop structure in simulink then you can use something like the following
with selector you index the vectors, then multiply the elements and then construct the output vector with a Matrix Concatenate and end the simulation with a stop based on the index number.
loop.PNG
Regards
MH

カテゴリ

Help Center および 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