how to use previous value in simulink? [(k-1) value]
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hyun Wook Kang
el 4 de Jun. de 2023
Respondida: Les Beckham
el 5 de Jun. de 2023
Currently, I am designing filtered velocity of the two wheel balancing robot, using encoder, and accelerometer, using following 2 equation.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1402514/image.png)
I am trying to use MATLAB function block in simulink, which is the following picture.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1402519/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1402524/image.png)
But there is an error which says that I can't use direct feedback..
Can somebody help me with this problem?
1 comentario
Respuesta aceptada
Les Beckham
el 5 de Jun. de 2023
It looks like what you need to do is remove the new_filtered_V input from your MATLAB function block and add this line at the top of your code:
persistent new_filtered_V;
That will eliminate the direct feedback and then the code will use the remembered previous value of new_filtered_V to update the new value.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Simulation and Analysis en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!