How do I change the Input data of the Constant Block When the sampling time comes?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Alaz Ozer
am 17 Jun. 2021
Kommentiert: Alaz Ozer
am 18 Jun. 2021
I want to change A and B values when the sampling time comes and do subtraction operation on Simulink.
The vectors A and B, as well as the sampling time, are created in the workspace. I add them to Simulink with Constant Blocks.
A = [ 3 5 7 9 ] , B = [1 2 3 4 ] , Ts= 0.1
On the right side of the figure, it can be seen that the Output is 4 parallel data (Data1 , Data2 , Data3 , Data4) when the sampling time comes. But I just want to give all datas of A and B with serial respect to sampling rate and just observe OUTPUT = Data1 on the table. Please Help me.
In Example: A = A[1] = 3 , B = B[1] = 1 at Time = 0
A = A[2] = 5 , B = B[2] = 2 at Time = 0.1 = 1*Ts
A = A[3] = 7 , B = B[3] = 3 at Time = 0.2 = 2*Ts
A = A[4] = 9 , B = B[4] = 4 at Time = 0.3 = 3*Ts
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 18 Jun. 2021
You would have to use sim() after having set a termination time on the model. Then you would set_param() to set the conditions of the block, and then you would set new boundary conditions and new termination time and sim() again.
I do not understand what you are trying to accomplish, but I am certain that changing the parameters of Constant blocks during running is not a good solution. What you are looking for looks to me to be closer to a From Workspace block that has been set not to interpolate.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sources finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!