How to control a servo motor using Simulink Matlab function block.

12 visualizaciones (últimos 30 días)
Aga
Aga el 9 de Abr. de 2021
Hello, I am trying to control a servo motor using an option of a Matlab function block in simulink. I am opting for this method because I want an output of the function block to feed into another block as an input and luckily the option is available in 2019b. However, I am still failing to do this. I have already controlled it successfully using a normal matlab script as below;
however when I use a function block, the motor doesnt run. And when I try to create a servo object,I get an error since it is not known for code generation. Below is my block and code.
The last line of anlogpin1 is something I added to see how it goes. However the motor is a basic 3 pin servo. I want the code to work like the code in the matlab script one(1st figure). Could someone help me with the way forward please? Thank you.

Respuestas (0)

Categorías

Más información sobre Motor Control Blockset en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by