almost-autnomous differential equation

4 ビュー (過去 30 日間)
Bob
Bob 2016 年 7 月 23 日
コメント済み: Star Strider 2016 年 7 月 24 日
y' = y^2 − t. This differential equation has “stationary” solutions, but unlike with an autonomous equation, those stationary solutions are not horizontal. Vary the initial condition y(0) = c for a bit to try to get a sense of what the solutions look like. (Picking values between −3 and +3 should be good enough.)
Part A: There’s a value P such that, if y(0) < P, then the solution to the initial value problem decreases, while if y(0) > P, the solution to the initial value problem increases. Figure out what P is to two decimal places.
Attempted code:
syms y(t);
for c = -3:1:3
fc = dsolve('Dy = y^2 - t' , y(0) == c);
end
Not sure how I get it to print out an answer for p and get it to be for p to two decimal places.

採用された回答

Star Strider
Star Strider 2016 年 7 月 23 日
編集済み: Star Strider 2016 年 7 月 23 日
You need to solve it symbolically, but then you can use the matlabFunction function to create an anonymous function from it:
syms y(t) c
fc(t,c) = dsolve(diff(y) == y^2 - t, y(0) == c);
fc_fcn = matlabFunction(fc)
fc_fcn = @(t,c) -(airy(3,t)+((sqrt(3.0).*gamma(2.0./3.0).^2.*3.0+3.0.^(2.0./3.0).*c.*pi.*2.0).*airy(1,t))./(gamma(2.0./3.0).^2.*3.0-3.0.^(1.0./6.0).*c.*pi.*2.0))./(airy(2,t)+((sqrt(3.0).*gamma(2.0./3.0).^2.*3.0+3.0.^(2.0./3.0).*c.*pi.*2.0).*airy(0,t))./(gamma(2.0./3.0).^2.*3.0-3.0.^(1.0./6.0).*c.*pi.*2.0));
You also need to decide on an appropriate range for ‘t’ if you haven’t already been given one. It might be easier to use a ribbon plot for this until you home in on the correct value for ‘c’.
  8 件のコメント
Bob
Bob 2016 年 7 月 24 日
Does this provide me with a value of c though.
Star Strider
Star Strider 2016 年 7 月 24 日
Not directly, but since I don’t understand what behaviour the particular value of ‘c’ is supposed to do, it should give you a way of determining the behaviour you’re looking for.
You can also plot the derivative (Jacobian) with meshc or contour if that would help:
t = linspace(0, 5, 50);
c = linspace(-3, 3, 50);
[T,C] = meshgrid(t,c);
fc_fcn = @(t,c) -(airy(3,t)+((sqrt(3.0).*gamma(2.0./3.0).^2.*3.0+3.0.^(2.0./3.0).*c.*pi.*2.0).*airy(1,t))./(gamma(2.0./3.0).^2.*3.0-3.0.^(1.0./6.0).*c.*pi.*2.0))./(airy(2,t)+((sqrt(3.0).*gamma(2.0./3.0).^2.*3.0+3.0.^(2.0./3.0).*c.*pi.*2.0).*airy(0,t))./(gamma(2.0./3.0).^2.*3.0-3.0.^(1.0./6.0).*c.*pi.*2.0));
dfc_fcn = gradient(fc_fcn(T, C));
figure(1)
contour(T, C, dfc_fcn, 50)
grid on
xlabel('t')
ylabel('c')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by