0

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.

Amir
  • 10,600
  • 9
  • 48
  • 75
Leonor
  • 29
  • 7

1 Answers1

0

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)
Gabriel Ilharco
  • 1,649
  • 1
  • 21
  • 34