Optimization with a differential term
显示 更早的评论
I am trying to find V_L(t) that can maximize the following function
P = {I_s*sin(wt) - [C*V_L'(t) + V_L/R]} * V_L
Any thoughts? Thank you very much!
15 个评论
Walter Roberson
2018-6-28
To confirm, that is
P = (I_s*sin(w*t) - C*(diff(V_L(t), t)) - V_L(t)/R) * V_L(t)
if so then it will be difficult to find.
Joseph Liu
2018-6-28
Torsten
2018-6-28
What do you mean by "maximize" ? The integral of |P(t)| taken over a certain time span ?
Walter Roberson
2018-6-28
Possibly. It does seem to fit the form set out in https://en.wikipedia.org/wiki/Euler%E2%80%93Lagrange_equation
Joseph Liu
2018-6-28
Hi,
im not very sure if this is helpful - but perhaps it is. The link Walter sent, is about calculus of variations. The birth of the calculus of variations is generally considered to be the solution of the equation of the brachistochrone. In the corresponding equation, the function also occurs with its derivative and the time for the route to be covered is to be minimized.
For this, there is the function functionalDerivative in the Symbolic Toolbox (introduced R2015a). There are some examples and a tutorial - including the problem of brachistochrone and minimal surfaces and any other.
This type of problem could be closely related to the structure of your problem.
Maybe this could help to find a solution for your problem. If not, I keep watching this thread, because it is a very interesting problem you have there.
Best regards
Stephan
David Goodmanson
2018-7-1
编辑:David Goodmanson
2018-7-1
Hi Stephan,
Are there any restrictions on V_L at the end points? If not, I believe that a function such as V_L = V0*exp(-g*t) with suitably large V0 and g allow this integral to be arbitrarily large.
Stephan
2018-7-1
Hi David,
I can not say that because it was not mentioned in the question and the previous comments. My intention is to show that the question is in my view a problem of the calculus of variations and Matlab provides a function in the symbolic toolbox which may help to solve the problem. I chose the Brachistochron example because it is THE example of the calculus of variations and it is also discussed in Matlab's documentation to explain the function.
Best regards
Stephan
David Goodmanson
2018-7-1
Hi Stephan,
Calculus of variations is certainly involved here, but to use it you have to satisfy certain conditions including specifications at the end points, and it matters whether a maximum or minimum is sought. For example for two fixed points in the plane, there is a minimum path length between them but no maximum path length.
For the problem as stated,
V = N*V0*exp(-N*w*t)
is a perfectly acceptable function to test for a maximum of the integral. Here N is a dimensionless constant and V0 is a fixed reference voltage such as 1V. Then:
syms I_s V V0 R C t w N
V = N*V0*exp(-N*w*t)
u1 = int(I_s*sin(w*t)*V,t,0,pi/w) % first term in integral
u2 = int(-C*V*diff(V,t) -V^2/R,t,0,pi/w) % second two terms in integral
% result
u1 = I_s*N*V0*(1/(w*(N^2 + 1)) + exp(-pi*N)/(w*(N^2 + 1)))
u2 = N*V0^2*(C*N*R*w - 1)*(1 - exp(-2*pi*N))/(2*R*w)
(u2 is the same as what Matlab provides except I multiplied through by a leading minus sign).
u1 is positive and contributes to the maximum. For large N, u2 is positive and arbitrarily large. So there is no maximum value for this problem.
Hi David,
what do you think about the attached approach? The units seem to fit the physics - even the result seems to me useful.
So far, I have understood the approach of variational calculation in such a way that the value of a functional should be maximized / minimized. For this, find the function f that gives the largest value to the functional.
So far I have not seen any approach in which the function f is assumed in advance. However, I have become accustomed to formulate very carefully here in the forum, since there are quite a few people on the way, from whom I can learn.
It would be nice if you - but also the other forum members involved in the discussion - would like to give their opinion on this approach. Maybe this is an approach - otherwise I am very interested in learning more about this topic.
Best regards
Stephan
David Goodmanson
2018-7-2
Hi Stephan,
Calculus of variations is concerned with all possible functions that meet some specified conditions. When you say 'assumed in advance' that's true, but I'm allowed to think up any function at all that satisfies the conditions and try it out. The one I chose shows that the integral has no maximum.
If, for example, you specify values of V at the boundaries t = 0, pi/w, then things change. The the Euler_Lagrange equation can come into play. Even then, the resulting expression is going to require a functional derivative with respect to dV/dt, as well as a functional derivative with respect to V.
Joseph Liu
2018-7-3
Hi,
did you already update your matlab? Maybe this helps for the problem wirh your symbolic toolbox:
Back to your question: I do not have much experience solving such problems. I just read something about it because I consider it an exciting topic. After Torsten was able to clarify the question, I understood that your functional is:
E = int (P, 0, pi / w)
For this functional, the function V_L is searched, which gives the functional an extreme value (really maximum?). So I chose that approach and set that expression equal to zero. But due to lack of experience or missunderstanding, it is possible that I am wrong here.
In fact, if i use functionalDerivative with P, set this equal to zero and then isolate V_L, i get the result you have calculated by hand. So i think you are right to use f instead of F for the calculation. Another day when I'm a bit wiser in the evening than I got up in the morning... ;-)
Best regards
Stephan
Walter Roberson
2018-7-3
If the symbolic engine was generally working but you got that internal error, then I suspect you ran out of memory.
Joseph Liu
2018-7-4
回答(1 个)
David Goodmanson
2018-7-5
编辑:David Goodmanson
2018-7-7
Hi Joseph,
( for constant V situation see [2] )
[1] ------------------
This is not an ordinary Euler-Lagrange situation. Often there would be a term involving (dV/dt)^2 so there is a high price to be paid for having a function with a large derivative. Here you only have a term proportional to V dV/dt. The resulting contribution to the functional depends only on the boundary values at t=0 and t=pi/w, and nothing more, i.e. not on the shape.
Boundary conditions (bc’s) specify boundary values, but if there are no bc’s the boundary values are free to come out like they come out.
If you do not specify bc's, then in general you are not justified in using Euler-Lagrange to find Fmax, as you did. Certainly that’s true for any functional that contains dV/dt as this one does.
As I mentioned in a previous comment on this thread, the original problem as stated does not have a maximum. For a function V(t) shown there, the functional can become arbitrarily large. That is very much related to the fact that you are not specifying bc’s for V at the end points. It does appear that you have the maximum F under restricted conditions though.
[2] ---------------------------------
The constant V problem does not specify bc's. But if you want to use a constant for V, just set V = constant and start integrating. Let
t1 = 0, t2 = pi/w, and I_s --> I, sin(wt) --> s, V_L --> V
The functional is
F = Int{t1,t2} [IsV -CVV' -V^2/R] dt
(here IsV means I_s*sin(wt)*V, hopefully this will not cause confusion)
In the functional, V' = 0 so the term involving C drops out. You can integrate the other two terms to get
F = IV(2/w) - (V^2/R)(pi/w)
which as a function of the scalar parameter V does have a maximum, which is
Fmax1 = (1/pi)(I^2R/w) = .32 (I^2R/w) <---- Fmax1
with
V(t1) = V(t2) = IR/pi. boundary values
This is a perfectly good calculation. No Euler-Lagrange in this case. Boundary values came out like they came out. There is no functional derivative, merely minimizing with respect to a parameter.
[3] ----------------------------
It’s interesting to compare that maximum with the one from the original question, which was to minimize the functional F for an arbitrary function V, also with unspecified bc’s. This can be done without using Euler-Lagrange, and leads to the same result that you found,
V = IRsin(wt)/2
Plugging that into F, the result is
Fmax2 = (pi/8)(I^2R/w) = .39 (I^2R/w) <-- Fmax2
Which is a bit larger than Fmax1.
ADDED
[4] I don't understand what you mean by the statement " Also in the example, it practices on a function F(x,y,y') instead of y' '. "
The term that I said was quite common in the functional is proportional to (V ')^2, and the form of f is still f(x,y,y'). Nothing involves f ' '.
[5a] As far as maximizing the functional
F = Int{t1,t2} [IsV -CVV' -V^2/R] dt,
first consider the term involving C. Its integral is
-(C/2)V^2 (evaluated at end points)
= (C/2) [V(t1)^2 - V(t2)^2] <-- the C term
The C term depends on the value of V at the end points, but not on the shape of V. This is an example of how important boundary values can be. The function V(t) I mentioned in a previous comment (I*R here replaces V0 there) is
V = N*I*R*exp(-N*w*t)
where N is a dimensionless number. For large N, this function is very large at t1 and much smaller at t2, so the C term makes a large contribution. The other two terms in F stay medium sized.
Since F can be arbitrarily large, it has no maximum. (There is no attempt here to maximize F under certain constraints. I only have to demonstrate that for some V(t), F can be arbitrarily large).
[5b]
For the original question, F can be maximized for the subclass of all possible V that meet the following boundary condition:
V(t1) = V(t2) condition 1
Then the C term goes away.
The strategy will be (a) maximize F for all possible functions V. (b) then show that the V that maximizes F obeys condition 1. This is the same as, but easier than, maximizing only those functions V that satisfy condition 1 from the get-go.
For the two remaining terms in F (that are not the C term), completing the square gives
F = Int{t1,t2} (1/R) [ (IR)^2(s^2/4) - (V-(IR/2)s)^2 ]
Since the second term in brackets comes in with a minus sign, it has to be minimized and since it is a squared term it must set to zero for all t. Then
V = IRsin(wt)/2
as you found. This has V(t1) = V(t2) = 0 and meets condition 1. The remaining (first) term gives
Fmax = (pi/8)(I^2R/w)
as previously demonstrated. No Euler-Lagrange in this process.
类别
在 帮助中心 和 File Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!