RC Circuit Simulation in Simulink Shows Incorrect Charging Time

17 Ansichten (letzte 30 Tage)
Xiaolong
Xiaolong am 11 Okt. 2025 um 10:12
Bearbeitet: Torsten am 11 Okt. 2025 um 18:40
Hello,
I am simulating a simple RC circuit in Simulink (MATLAB R2025b) to observe the capacitor charging time. The circuit consists of a 1V DC voltage source, a 1-ohm resistor, and a 1-µF capacitor.
According to theory, the time constant (τ = R*C) is 1 µs. This means the capacitor voltage should reach approximately 63% of the source voltage (about 0.63V) at t = 1 µs.
However, my simulation shows a significant delay. The capacitor voltage only begins to rise noticeably between 2 µs and 3 µs, and does not match the theoretical curve at all.
I have attached my model file for reference. Could you please help me understand why the simulation results do not align with the theoretical expectations? I suspect it might be related to my solver configuration.
Thank you for your help.
  1 Kommentar
Torsten
Torsten am 11 Okt. 2025 um 18:38
Bearbeitet: Torsten am 11 Okt. 2025 um 18:40
Can you set a start stepsize "InitialStep" ? Then use 1e-2*R*C [s] , e.g.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Paul
Paul am 11 Okt. 2025 um 15:42
Hi Xiaolong,
Disclosure: I did not actually open your model.
If you know the fastest system dynamics are on the order of 1e-6,consider changing the Max Step Size in the solver from auto to 1e-7, at least to see if that gets things going in the correct direction.
load_system('untitled');
c = getActiveConfigSet('untitled');
get_param(c,'Solver')
ans = 'VariableStepAuto'
get_param(c,'MaxStep')
ans = 'auto'
You can change the the Max Step Size in the Solver Pane, which can be acessed as shown at Set Model Configuration Parameters for a Model.

Kategorien

Mehr zu Circuits and Systems finden Sie in Help Center und File Exchange

Produkte


Version

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by