Hello!
I have a model, of which the input is an array, values differ from time 1 to 10, and I expect the output, which generated by multiplying input values and operators, is also an array from time 1 to 10.
I tried and according to the Simulink algorithm, input value at time T can only be multiplied by operator values at time T, but what I expect is, each input will be individually multiplied throughout the whole simulation time.
%This is what I expected.
Input = 1:10;
Time = 1:10;
for i = 1:10
for o = 1:10
Output(i) = Time(o) * Input(i)
end
end
For instance, I input a number at time 1, it will be multiplied by a series of operators from time 1 to time 10, and then there is an output 1 (time 1:10) for input 1;
then I have an input 2, it will also generate an output 2 (time 1:10) for input 2, and as well for input 3, 4, ..., 10.
I think it is difficult under the algorithm of Simulink, so I wonder if it is possible to achieve it by rerun the entire model for 10 times, and each time before it starts, to have a messagebox or something to let me input the values?
I read about callbacks but seems there is no parameters I can use to do it?

댓글 수: 3

madhan ravi
madhan ravi 2020년 5월 25일
편집: madhan ravi 2020년 5월 25일
Have you tried using lookup tables? Or parameterisation using MATLAB scripts?? A picture of the model/an attached model file would help to understand clearly what is going on. Instead of editing the question 100 times , you could simply respond to my questions ;).
Jingwei Zhou
Jingwei Zhou 2020년 5월 25일
Hello, thank you for your comment.
I am sorry I was editing the question because I found something wrong with the code I paste.
I havn't tried these, I will check them out!
madhan ravi
madhan ravi 2020년 5월 25일
Not a problem :), take your time.

댓글을 달려면 로그인하십시오.

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 5월 26일

0 개 추천

In general, most Simulink blocks support vector and array input. For example, the multiply (Product) block supports element-wise or matrix multiply. So I think you can just layout your algorithm using blocks and let the array data pass through. See this
https://www.mathworks.com/help/releases/R2019b/simulink/slref/product.html

댓글 수: 2

Jingwei Zhou
Jingwei Zhou 2020년 5월 26일
Thank you very much!
Moreover, I wonder that when I open a top model, if I can run a reference model before I run the top model?
Fangjun Jiang
Fangjun Jiang 2020년 5월 26일
If you are at the top model and want to run simulation for the top model, you don't need to do anything about the reference model. If you open the reference model from there, the opened reference model is treated as a separate model. You can run simulation for it but it does not have anything to do with the top model.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

제품

릴리스

R2018a

태그

질문:

2020년 5월 25일

댓글:

2020년 5월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by