0
votes

I am trying to solve this transcendental equation

x = ((g*T^2)/(2*pi))*tanh(2*pi*d/x)

Where

g = gravitationnal constant (9.81 m/s^2)

T = périod of my signal (s)

d = depth of the water (m)

I want to solve x for given values of g, T and d.

This is what Matlab sent me back after running the code

    g=9.81;
    d=3;
    t=100;
    syms x
    s='g*t*tanh(2*pi*d/x)-x=0';
    -1*solve(s)

    Warning: Explicit solution could not be found. 
    > In solve at 179
    In Itteration at 6 

    ans =

    [ empty sym ]

I wrote -1*solve(s) because i want the positive answer, but that is not important. I checked on many answers and questions on transcendental equations but I found nothing.. But, there was an answer that has the same problem I have :

how can I solve transcendental equation?

He gets the same ''empty sym'' I have. I can solve the equation with numerical values of g, T and d in the code, but as soon as I put variables, it gives me the same error.

Help!!

Félix Blais

2

2 Answers

0
votes

I did it with fzero. I plotted the function first in order to get an approximation of where to start looking.

g=9.81;
d=3;
t=100;
func=@(x)(g*t*tanh(2*pi*d*1./x)-x)
x0=fzero(func,-200); % find root
disp(x0) %  x0 = -135.5475
disp(func(x0)) % func(x0)= -2.8422e-014

Since your function is anti-symmetric, -x0 = 135.5475 is also a solution.

0
votes

I tried this:

s='9.81*100*tanh(2*pi*3/x)-x=0';

instead of

s='g*t*tanh(2*pi*d/x)-x=0';

which did not work, and it was OK, but don't know why.