0
votes

I would like to solve the following equation in MATLAB:

L=(9.81.*P.^2)./(2.*pi).*tanh(2.pi.(d./L))

The P and d are predefined vectors. L is the variable to be solved to.

I try to solve this problem with:

%First guess
L0 = 1.56 * P;
fsolve( @(L)  L - (9.81.*P.^2)./(2.*pi).*tanh(2.*pi.*(d./L), L0 )

The upper code doesn't work.

1
Why doesn't it work? Does it yield incorrect results, does it run ito errors? - Adriaan
gives an error input need two arguments - Leonor
Can you add some small example P and d? - hbaderts

1 Answers

0
votes

The problem is with your unbalanced statement - you are missing a ). Try this:

L0 = 1.56 * P;
your_function = @(L)  L - (9.81.*P.^2)./(2.*pi).*tanh(2.*pi.*(d./L))
fsolve(your_function, L0)