Trouble solving for extreme values of a differential equation.

1 回表示 (過去 30 日間)
Patrick Myers
Patrick Myers 2021 年 3 月 24 日
コメント済み: Patrick Myers 2021 年 3 月 29 日
Hello,
I'm trying to solve the most probable energy for this probability density function, P(E) = A.*sinh(sqrt(2.*E)).*exp(-E). I solved for A in my code but when I take the derivative and try to solve it at zero I get a large, relative to the expectation, negative number. For the situation the function is from the energy cannot be negative. I'm unsure what I'm doing wrong could you help me? Here's my code:
%% Problem 3
% Part A
syms E
P = @(E) sinh(sqrt(2.*E)).*exp(-E);
A = double(1./int(P(E), 0, Inf));
disp(A);
% Part B
dPdE = @(E) diff(A.*P(E));
solution = solve(dPdE(E));
  4 件のコメント
darova
darova 2021 年 3 月 25 日
DO you have original equations?
Patrick Myers
Patrick Myers 2021 年 3 月 25 日
編集済み: Patrick Myers 2021 年 3 月 25 日
P(E) = A.*sinh(sqrt(2.*E)).*exp(-E)
This is the density function
I solved for A using normalization which gives me 0.484 so...
P(E) = 0.484.*sinh(sqrt(2.*E)).*exp(-E)
If you take the derivative, set it to zero, and solve for the E the energy should be the most probable energy. The one thing I see I'm missing is dPdE = @(E) diff(A.*P(E)) == 0; but I ran this and still got -177.

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

回答 (1 件)

darova
darova 2021 年 3 月 25 日
You are trying to solve your equation symbolically (to get analytical expression). I think it's impossible
Try fsolve or vpasolve
  1 件のコメント
Patrick Myers
Patrick Myers 2021 年 3 月 29 日
That answer didn't work unfortunatly, I still got the same aswer, but I ended up just plotting the derivative and picking off the zero I needed. Thank you for your effort.

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

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by