필터 지우기
필터 지우기

How can I generate a pulse with variable frequency?

조회 수: 15 (최근 30일)
Fazil Doruk Inanc
Fazil Doruk Inanc 2020년 5월 1일
댓글: Fangjun Jiang 2020년 5월 4일
I'm working on a Cable Robot project where I am expected to control the speed of the cables by changing the frequency of the stepper motors integrated in the system. I already sorted out how to generate a pulse with specific amount of steps for position control but I couldn't sort out how to alter with the frequency of the pulse.(For controlling the speed of the stepper motor)
Here is the set of blocks for generating a pulse with specific number of steps;
10 steps is generated in the given example
pulse type is time based and simulation time is used.
Thank you for your time

채택된 답변

Fangjun Jiang
Fangjun Jiang 2020년 5월 1일
편집: Fangjun Jiang 2020년 5월 1일
In this model, the number of pulses and the frequency of the pulse are coupled. The simulation step, the sample time of the counter and the frequency of the pulse generator all need to work together to get the desired output. After you got 10 pulses, if you double or half the frequency of the pulse generator, you won't get the desired output.
Varying the frequency of the pulse is a tough task. Many blocks have frequency as a parameter, not a time-varying input.
I have a suggestion. Make f as an input, multiple it with 2*Pi and then use "Fcn" block to do the sin() operation then you will get sin(2*pi*f) which is a variable-frequency sine wave. Compare it with zero will give you the pulse athough the pulse width is also changing.
Then you will have some blocks to count the pulses. If the pulse signal has a rising edge, add one. Otherwise, do nothing. Compare the counter with your preset number of pulses. Use this comparison to control a Swith, passing either the pulse signal or zero.
Voila
  댓글 수: 2
Fazil Doruk Inanc
Fazil Doruk Inanc 2020년 5월 2일
편집: Fazil Doruk Inanc 2020년 5월 3일
Thank you again for your answer. Could you please provide a step by step instruction with the block types that I should use after obstructing sin(2*pi*f)
Fangjun Jiang
Fangjun Jiang 2020년 5월 4일
triggered subsystem (use rise edge as the trigger), z delay block used as the counter

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discontinuities에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by