Calculate previous and current values from signal builder
2 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Fei Deng
on 1 May 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,..]
More Answers (0)
See Also
Categories
Find more on Sources in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!