how to write algorithm
5 次查看(过去 30 天)
显示 更早的评论
Please help me with the algorithm of the formula in the attached file................
1 个评论
Walter Roberson
2014-4-5
We can't give an algorithm until you indicate what values are to be input and what values are to be output.
回答(2 个)
Star Strider
2014-4-5
Assuming that you may not have the Symbolic Math Toolbox, this should get you started:
syms A E(x) Z b c d E0
Eqn1 = -diff(E,x)/p == (3574/A) * E^(-b) * Z^(c*log(E)+d);
SEqn1 = dsolve(Eqn1, E(0) == E0); % E(0) == E0, initial condition
SEqn1 = simplify(collect(expand(SEqn1)));
E = matlabFunction(SEqn1)
produces:
E = @(A,E0,Z,b,c,d,p,x)(-(Z.^d.*p.*x.*3.574e3-A.*E0.^(b+1.0).*exp(-c.*log(E0).*log(Z))+Z.^d.*b.*p.*x.*3.574e3-Z.^d.*c.*p.*x.*log(Z).*3.574e3)./A).^(1.0./(b-c.*log(Z)+1.0));
The rest is yours to solve, since I haven’t shot a proton at a target in a very long time.
It looks rather straightforward, otherwise.
0 个评论
另请参阅
类别
在 Help Center 和 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!