Square voltage source and inductors.

16 views (last 30 days)
Michel
Michel on 7 Nov 2025 at 15:02
Commented: Umar about 13 hours ago
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?

Answers (1)

Umar
Umar on 8 Nov 2025 at 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 Comment
Umar
Umar 14 minutes ago

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

Sign in to comment.

Products


Release

R2025a

Community Treasure Hunt

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

Start Hunting!