- Write the equation above using basic Simulink blocks (e.g., Add, Unit Delay, Gain).
- Use a Discrete Derivative Block (under the "Discrete" folder). The input to this block would be the samples coming from the encoder. The output would be your velocity.
- Use a Difference block (from the "Discrete" Folder) followed by a gain block
Encoder position derivative Simulink
6 views (last 30 days)
Show older comments
Hi, I'm new of simulink and I'm doing some test on a DC motor connected, through a servomechanism, to a disk.The position of the disk is given by an encoder. A block in Simulink gives me out the number of rounds of the disk. How could I derivate this data to obtain velocity? I know the sample time of the encoder; but I do not manage to: -save (online measuraments) the samples, -make a difference between the new sample and the previous one -at the end devide by sample time. What kind of block could I use to save a sample each sample interval? Thank you very much every one.
0 Comments
Answers (2)
Richard Zappulla
on 30 Mar 2017
As for saving the data, I would suggest using a "To File" block (under the "Sinks" folder). In the image below, I used a vector concatenate block to form a vector which goes into the "To File" block. You can also use a Mux block as well in this case.
If you use the "To File" block, make sure you have the right "Save Format" selected. You can either save it as an Array (which automatically add the model time as the first row in the data) or a Timeseries object (link to documentation for Time Series Objects )
To differentiate the encoder position to get its velocity, I first assume you are using a fixed-step or discrete model. (If you are not, there are continuous versions of these blocks that you can use). The velocity can be found by modeling the following equation in Simulink:
velocity = (sample(n) - sample(n-1))/Ts
You can perform this a few ways ( Note: items correspond with the picture below):
Hope this helps!
0 Comments
Marco
on 30 Mar 2017
1 Comment
Domenico Tuccillo
on 27 Nov 2023
Edited: Domenico Tuccillo
on 27 Nov 2023
Did you find out if it's a problem for a controller?
See Also
Categories
Find more on Inputs 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!