Calculate previous and current values from signal builder
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
siti khadijah
el 27 de Abr. de 2017
Comentada: siti khadijah
el 8 de Mayo de 2017
Hai guys,
I need your advice as well as help. I use signal builder as an input the matlab function in simulink, and I used the matlab function to calculate the inverse kinematics of my system. The problem now is, I need to calculate difference of the previous and current values from the inverse kinematics.
For instance, 3 values are sent from signal builder : 0, 30 and 70. These values will be recalculated in the inverse kinematics and I set them as 'theta'. And the next thing that I want to do is to calculate : 30 - 0 = 30; 70 - 30 = 40;
But I dont have any idea to do that since the input is in signal builder. Hope any of you could helps or advice me on this matter. Thanks
-CT_
0 comentarios
Respuesta aceptada
Fei Deng
el 1 de Mayo de 2017
There are two ways to do it.
1. In the MATLAB function block you write:
function y = fcn(u1,u2)
y = u1-u2;
feed the signal from "signal builder" to u1 (input of MATLAB function block), and delay the signal by "Unit delay" block and feed it to u2.
2. if you are only doing subtraction in the MATLAB function, you can use a sum block(+-) instead. feed the signal into "+", and delay it with a "unit delay" and feed it into "-".
note that the step size of your solver need to be adjusted to the time difference for data [0, 30, 70,..]
Más respuestas (0)
Ver también
Categorías
Más información sobre Sources en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!