Could somebody help me to implement an algorithm with stateflow?
3 次查看(过去 30 天)
显示 更早的评论
I would like to implement an algorithm to charge or discharge my energy storage system with two loops. Could you please help me to do this with stateflow or with matlab code? thank you!
0 个评论
回答(2 个)
Apeksha Bagrecha
2022-9-20
The idea would be to retain the information of the variables in a state between time steps and then use that information to add or shift elements accordingly. There are various ways of doing it and one possible approach would be to call Graphical Functions in States, where in each call to the function, the entire loop is executed and data written to the array accordingly.
The attached example (testRingBuffer_TS.slx) implements a ring buffer of size 5 using the graphical function in states of a Stateflow chart.
Additional information on Graphical Functions can be found at our documentation page
>> web(fullfile(docroot, 'stateflow/flow-graph-algorithm.html'))
0 个评论
Benjamin Thompson
2022-9-19
Please start with the Stateflow Onramp Training on the Mathworks website. Then try to implement your algorithm and if you have specific problems post a new question with sample files attached.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!