Square voltage source and inductors.

16 visualizaciones (últimos 30 días)
Michel
Michel el 7 de Nov. de 2025 a las 15:02
Comentada: Umar hace alrededor de 11 horas
Hi, I have this circuit. I'm trying to connect the controlled voltage souce as mentioned in other answers in order to get an square wave an see it in the scope but I can't connect it. Any advice?

Respuestas (1)

Umar
Umar el 8 de Nov. de 2025 a las 6:46

Hi @Michel,

I took a look at your circuit diagram — The reason you can’t connect the square-wave (Pulse Generator) output to the Controlled Voltage Source is that they belong to different simulation domains.

In your model, the Pulse Generator outputs a Simulink signal (a normal numeric waveform), while the Controlled Voltage Source expects a physical signal from the Simscape environment. Because of this, Simulink prevents a direct connection between the two — which is why you’re seeing that red dashed line at the input port.To make the connection work, you just need to add a converter block that bridges the two domains:

1. From the Simscape > Utilities library, drag in a Simulink-PS Converter block. 2. Connect your Pulse Generator output to the input of the converter. 3. Then connect the converter output to the control port of the Controlled Voltage Source.

This converter turns the Simulink signal into a physical Simscape signal that the voltage source can interpret. Here is the correct wiring order

Pulse Generator > Simulink-PS Converter > Controlled Voltage Source (control input)

Controlled Voltage Source (+,– terminals) > Circuit (L and R) > Simscape Electrical Reference

Voltage Sensor > PS-Simulink Converter > Scope

Some additional tips to keep in mind which will help further.

  • Make sure you’re using the Simscape Electrical Reference (the blue ground symbol) at the bottom of your circuit — not a regular Simulink ground.
  • If your waveform looks distorted, reduce the simulation step size or use a fixed-step solver to capture the square-wave edges more clearly.
  • To display the voltage waveform in the Scope, remember to use a PS-Simulink Converter after the Voltage Sensor block.

Once again, if you add the converter, the red dashed line should disappear, and your square-wave voltage will drive the circuit correctly. You’ll then be able to view the resulting voltage or current response in the Scope.

  1 comentario
Umar
Umar hace alrededor de 11 horas

Hi @Michel, Please let me know if you need further assistance.

Iniciar sesión para comentar.

Productos


Versión

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by