- 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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Richard Zappulla
2017-3-30
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 个评论
Marco
2017-3-30
1 个评论
Domenico Tuccillo
2023-11-27
编辑:Domenico Tuccillo
2023-11-27
Did you find out if it's a problem for a controller?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Inputs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!