Plot functions about calculus of variations

1 view (last 30 days)
Haku Bo
Haku Bo on 19 Sep 2019
Commented: Walter Roberson on 20 Sep 2019
Hello everyone,
I am new to Matlab.
My codes are:
syms a X(t) c T
assume(T>0)
F(t) = int(a*X(t)-(c/2)*(diff(X(t))^2),t,0,T)
D = functionalDerivative(F,X)
assume(a,'positive')
assume(c,'positive')
S = dsolve(D, X(0)==X0, X(T)==0)
I want to plot the solution S at time t, but did not know how to do it.
Thank you for helping!
  4 Comments
Julieth Santamaria
Julieth Santamaria on 20 Sep 2019
Strickly speaking, for matlab S(t) is not a function. So fplot won't work.
Walter Roberson
Walter Roberson on 20 Sep 2019
I had no problem using fplot once I had substituted in enough values to make it a function of a single variable, such as
SS(t) = subs(S, {X0, a, c,T}, {152, -9.81, 13, 11});
fplot(SS)

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!