I am a new user in MATALAB
how I can solve vander pauw equation drectily to get the resistance R
exp(-pi*100/R)+exp(-pi*79/R)=1

답변 (2개)

John D'Errico
John D'Errico 2019년 5월 22일

2 개 추천

First, see that no symbolic solution will exist. If we have the general problem:
exp(-A*x) + exp(-B*x) == 1
then by the transformation u = -B*x, this reduces to
exp(C*u) + exp(u) == 1
for C = A/B.
With one more transformation, v = exp(u), thhis reduces to the quasi-polynomial form:
v^C + V == 1
where C is not an integer. Clearly that has no analytical colution for v, and therefore not for x either.
Of course, solve finds nothing, as expected.
syms x A B C
solve(exp(A*x) + exp(B*x) == 1,x)
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
ans =
Empty sym: 0-by-1
solve(exp(C*x) + exp(x) == 1,x)
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
ans =
Empty sym: 0-by-1
That leaves you with a numerical solution as the main option.
syms R
vpasolve(exp(-pi*100/R)+exp(-pi*79/R)==1)
ans =
403.70410829770738335461645229766
Or of course, you could use fzero or fsolve.
fun = @(R ) exp(-pi*100 ./R) + exp(-pi*79 ./R) - 1;
fzero(fun,500)
ans =
403.704108297707
If you do, then you need to choose a viable starting value.
In your followup comment, you asked if you change the constants to much larger values. Here, one of the variations I showed will make it much easier. That is, if we transform the problem into the form:
exp(C*u) + exp(u) == 1
where
u = -B/R
then
A = -pi*13750;
B = -pi*13820;
C = A/B
C =
0.99493487698987
Now just solve it as:
Rsolve = @(A,B) B/fzero(@(u) exp(A/B*u) + exp(u) - 1,1);
Rsolve(-pi*100,-pi*79)
ans =
403.704108297707
Rsolve(-pi*13750,-pi*13820)
ans =
62478.4449664911
The nice thing is now, 1 will generally always be a decent starting value in the call to fzero. As a test, we have:
A = -pi*13750;
B = -pi*13820;
R0 = Rsolve(-pi*13750,-pi*13820)
R0 =
62478.4449664911
exp(A/R0) + exp(B/R0)
ans =
1
Star Strider
Star Strider 2019년 5월 17일

1 개 추천

Convert your equation to an anonymous funciton, then use the fzero function:
vdp = @(R) exp(-pi*100./R)+exp(-pi*79./R)-1;
R = fzero(vdp, 1E+3)
producing:
R =
403.7041
I plotted this, and there appears tobe only one zero-crossing.

댓글 수: 5

Tahani Almutairi
Tahani Almutairi 2019년 5월 17일
Thanks but with
exp(-pi*90.82/R)+exp(-pi*90.23/R)=1
I expect R=410300000
Those are different constants. And your value for ‘R’ seems to be missing a decimal point.
With that value for ‘R’:
R=410300000
Val = exp(-pi*90.82./R)+exp(-pi*90.23./R)
I get:
Val =
1.99999861373348
That approximately equals 2, not 1.
Both the Symbolic Math Toolbox solve function and the Optimization Toolbox fsolve function solve your latest constants with:
vdp = @(R) exp(-pi*90.82./R)+exp(-pi*90.23./R)-1;
R =
410.29
Something is wrong with your code if you are getting different results with the constants you posted.
Not that there is any doubt that SS's result is correct, but here is some confirmation with a different method. With the two constants so close to each other, each of the terms
exp(-pi*90.82./R) and exp(-pi*90.23./R)
must approximately equal 1/2, right? Taking 90.525 as the average of the two constants, then
exp(-pi*90.525/R) = 1/2
R = -pi*90.525/log(1/2) = 410.29
Tahani Almutairi
Tahani Almutairi 2019년 5월 22일
THANKS for all replly
If I replaced the 100 and 70 By another values say 13750 and 13820
Is the steps above still valid for example
vdp = @(R) exp(-pi*13750./R)+exp(-pi*13820./R)-1;
R = fzero(vdp, 1E+3)
what is the role of the second step ?
Star Strider
Star Strider 2019년 5월 22일
Yes, theoretically. Those much larger values will overflow the exp function, leading to meaningless results.
The ‘second step’ is the fzero call to calculate the root.
Try plotting your function.
Experiment to get the result you want.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

질문:

2019년 5월 17일

답변:

2019년 5월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by