cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

RC Circuit Odesolve Issue

Shivas
3-Visitor

RC Circuit Odesolve Issue

I am trying to simulate RC Circuit with Pulsed Input. I am getting small notch at the transition, Which goes away at high tau values.

 

I am new to mathcad,Please provide insights.

 

Regards,

 

Shiv

 

1 ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:Shivas)

It may help to set the step size of Odesolve,  using the extra parameter to the Odesolve function.

If that works, I think that is a better way than to strip off data...

 

Success!

Luc

View solution in original post

7 REPLIES 7
LucMeekes
23-Emerald III
(To:Shivas)

Odesolve uses a numeric approximation algorithm where the output value at every next time step is calculated on the basis of previous output values and the input. Now your input is an ideal square wave, so it jumps instantaneously. This may cause an overshoot in the next time value. This overshoot will be damped as the tau value increases.

 

Success!
Luc

 

What do you recommend to remove this overshoot. Some hint would be enough.

 

Thanks for the help.

LucMeekes
23-Emerald III
(To:Shivas)

It may help to set the step size of Odesolve,  using the extra parameter to the Odesolve function.

If that works, I think that is a better way than to strip off data...

 

Success!

Luc

Thanks for the help.

Werner_E
24-Ruby V
(To:Shivas)

First of all let me say that in Prime (on contrary to Mathcad 15 and below) you are allowed to use units in a solve block with "odesolve". Therefore its not necessary to strip the units as you did. See screenshot and attached Prime 6 worksheet.

 

I don't think that you can get rid of those overshoots which stem from the numeric methods used (unfortunately Prime is not able to solve an ODE symbolically).

You can use some cheats to avoid those overshoots showing in the plot, though.

1) You may setup a larger step width in your range for t. You'll have to experiment which value fits best. The drawback is that the vertical lines are not vertical but have a slight visible slope now and that you get rounded corners.

Werner_E_0-1594387197144.png

 

2) You may define a function (I called it x2) based on the results of the solve block function which simply cuts off those overshoots.

Werner_E_1-1594387382442.png

 

Luc is perfectly right with his suggestion to increase the step width in "odesolve". In case  you don't know - its an optional fourth argument of "odesolve". The default value is 10^3.

Werner_E_0-1594392311388.png

 

Shivas
3-Visitor
(To:Werner_E)

Yeah, I also Tried it. Thanks for the help. 

Top Tags