Message Boards Message Boards

0
|
1504 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Calculate the maximum possible value of dt

Posted 10 months ago

ilerror is a relationship that includes t and dt, Now I assume a value of error=0.005, and I want to find the maximum value of dt for ilerror without exceeding error. What method can I use?

I attempted to solve using the following code, but MMA was unable to calculate the result.

{r = 22, l = 2 10^-1, c = 1 10^-4, vi = 24, initvalueil = 0, 
  initvaluevc = 0, tstart = 0, tend = 0.008, limitdt = 0.0001, 
  error = 0.005};
\[CapitalDelta]vi = 0;
A = {{0, -1/l}, {1/c, -1/(r c)}};
G = Inverse[A];
B = {1/l, 0};
S1 = Inverse[DiagonalMatrix[{1, 1}] - dt*A + 1/2*dt*dt*A . A];
S2 = Inverse[DiagonalMatrix[{1, 1}] - dt*A];
STAR1 = S1 . G . (B*vi + G . B*\[CapitalDelta]vi/dt) - 
   G . (B*(vi + \[CapitalDelta]vi) + G . B*\[CapitalDelta]vi/dt);
STAR2 = S2 . G . (B*vi + G . B*\[CapitalDelta]vi/dt) - 
   G . (B*(vi + \[CapitalDelta]vi) + G . B*\[CapitalDelta]vi/dt);
X0 = {0, 0};
X[t_] := 
  Simplify[(MatrixPower[S1, i] - MatrixPower[S2, i]) . 
      X0 + (DiagonalMatrix[{1, 1}] . (DiagonalMatrix[{1, 1}] - 
          MatrixPower[S1, i]) . 
        Inverse[DiagonalMatrix[{1, 1}] - S1]) . 
      STAR1 - (DiagonalMatrix[{1, 1}] . (DiagonalMatrix[{1, 1}] - 
          MatrixPower[S2, i]) . 
        Inverse[DiagonalMatrix[{1, 1}] - S2]) . STAR2] /. {i -> 
     t/dt};
ilerror = X[t][[1]];
condequal = Abs[ilerror] == error;
maxil = NMinimize[{dt, condequal, tstart <= t <= tend, 
   0 <= dt <= limitdt}, {t, dt}]
POSTED BY: James James
3 Replies
Posted 10 months ago

Thank you for your answer! I have posted a new question. If it's convenient, could you please help me take a look.

POSTED BY: James James

If you need the maximum value of dt, why are you using NMinimize instead of NMaximize?

POSTED BY: Gianluca Gorni

From

Plot3D[Abs[ilerror], {t, tstart, tend}, {dt, 0, limitdt}]

I see that the condition condequal is never verified in your domain. You should try a value of error less than .003.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract