how to solve an exponential equation with one unknown in matlab

조회 수: 8 (최근 30일)
Alice Faisal
Alice Faisal 2018년 7월 19일
답변: Abraham Boayue 2018년 7월 20일
I have an equation that need to be solved for rs, and I could'nt get the answer in matlab I have values for the other parameters and I need to get rs. But when computing it on MATLAB I dont get a correct answer This is the equation
exp((-pi*ra)/rs)+exp((-pi*rb)/rs)=1
ra=90.82*10^6 rb=90.23*10^6 so only rs in unknown

채택된 답변

Abraham Boayue
Abraham Boayue 2018년 7월 20일
Try the following code which uses Newton's method to find the root of the f(x) = 0.
close all;
clc;
N = 50;
ra = 90.82e6;
rb = 90.23e6;
a = pi*ra;
b = pi*rb;
tol = 1e-10;
x0 = 0;
x = x0;
xn = x;
for k = 1:N
f = exp(-a*x) + exp(-b*x)-1;
fd = -(a*exp(-a*x) + b*exp(-b*x));
x = x-f/fd;
err = abs(x-xn);
xn = x ;
if err<tol
break;
end
end
rs = 1/xn;
disp(rs)

추가 답변 (1개)

madhan ravi
madhan ravi 2018년 7월 20일
편집: madhan ravi 2018년 7월 20일
%Try this:
syms rs
ra=90.82*10.^6
rb=90.23*10.^6
rs=vpasolve(exp((-pi.*ra)./rs)+exp((-pi.*rb)./rs)-1,rs)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by