Hello Samson,
I understand from your issue that the motor speed is not changing in your model when you change the PWM pulses provided to the MOSFET, and you are not getting the desired waveforms in your model outputs.
Please know that it is because of the MOSFET continuously turning on and off due to which is an expected behaviour for the current to be discontinuous as has been found in your model output.
In this case, the possible ways you can control the speed of the motor in your model are as follows:
- The duty ratio of the PWM can be varied by changing the "Comparator" block input in the non-inverting terminal through "Controlled Voltage Source".
- The constant block input (2.5 in your case) is varied to change the reference value which in turn changes the turn on time of MOSFET to vary the motor speed.The readings of speed with the variation of reference that have been found are shown below.
Reference value : 2.5 - Speed : 250
Reference value : 2.1 - Speed : 232
- The spikes in the output of PWM output from "Comparator" can be reduced by reducing the value of its "Output resistance" parameter.
Hope this helps you in resolving the issue.