フィルターのクリア

How to solve iteratively equation

2 ビュー (過去 30 日間)
Jan
Jan 2018 年 12 月 11 日
コメント済み: Stephan 2018 年 12 月 11 日
I hava next equation
p0=sqrt(1+64*beta)
p=p0+8*(1/p0-1)
and i need to solve it for beta where I have exact value for p. How can I do it iteratively or on some other way in Matlab?
  1 件のコメント
Stephan
Stephan 2018 年 12 月 11 日
Hi Jan,
see my answer below to get a solution to your problem. I saw that you got some answers on your questions here in the forum. Did you notice that you can accept and/or vote for useful answers? This is the easiest way to thank the volunteers here for their help.

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

回答 (1 件)

Stephan
Stephan 2018 年 12 月 11 日
編集済み: Stephan 2018 年 12 月 11 日
Hi,
there is an analytic solution:
syms p0 p beta
eqn1 = p0 == sqrt(1+64*beta);
eqn2 = p == p0+8*(1/p0-1);
eqn2 = subs(eqn2,p0,rhs(eqn1));
% analytic solution
sol = isolate(eqn2,beta);
% function handle for numeric calculations
fun = matlabFunction(rhs(sol));
% assume a value (or vector of values for p)
p_exact = [2.5 5 10];
% get numeric results
result = fun(p_exact)
In case you do not have access to the Symbolic Math Toolbox, here is the function handle to calculate beta from known p-values:
fun = @(p)1.0./(p./1.6e1+sqrt(p.*1.6e1+p.^2+3.2e1)./1.6e1+1.0./2.0).^2./6.4e1-1.0./6.4e1
Best regards
Stephan

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by