Simulink with Simscape make mistake while calculating derivative

10 views (last 30 days)
Hello everyone,
I got stucked with som huge project involving Simulink and Simscape, and to find a solution I tested very simple model containing AC current source and inductor.
The parameters of the inductor are as follows
and the current source
I measure the current and the voltage of the coil. Since L = 1 H I was expecting to observe voltage being a derivative of the current. However, using both voltage sensor and standard derivative I get a cosine wave (current is a sine wave), but with higher amplitude.
This is really weird because, when I calculate a derivative of a Sine Wave, at the bottom of the model, I got what I expect - cosine wave with same amplitude as input.
What I observed so far, that if I multiply the current amplitude by 2, then the voltage amplitude (measured and calculated by du/dt) is also multiplied by 2. It seems to me like some numerical problem. When I was playing with settings of Fixed-Step 14s method I also noticed an impact of those parameters.
Below Solver Configuration and Simulation parameters are presented.
I would be very grateful if anyone could explain me this behaviour. Is there a way to get rid of that?
Best regards, Michal

Answers (1)

Ryan G
Ryan G on 11 Oct 2013
It appears to be a units issue, at least with your understanding of the mathematics. Put the frequency in as 1/(2*pi) hz, equivalent to 1 rad/s, and you should see the results you expect.
I believe the problem is the frequency you put in is faster than you think. The faster the frequency, the larger the derivative. So when you put in 1Hz, you think the derivative should be the equivalent magnitude, when in reality the derivative at that frequency is 2*pi larger because it's defined in Hz instead of rad/s. Look at your current results, 10*2*pi = ...

Categories

Find more on Variable Initialization in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!