Solving trigonometric equation problem

26 ビュー (過去 30 日間)
cetingrdk
cetingrdk 2020 年 5 月 2 日
コメント済み: Ameer Hamza 2020 年 5 月 3 日
Hello I couldn't solve this equation on Matlab.Can anyone help me?
I want to find at least 6 roots.I'm trying to find frequency of beam.
(sin(x)-sinh(x))*(-x*sin(x)-x*sinh(x))-(cos(x)-cosh(x))*(x*cos(x)-x*cosh(x))=0
Same one is below.
  2 件のコメント
Image Analyst
Image Analyst 2020 年 5 月 2 日
x = linspace(-45, 45, 20000);
y = (sin(x)-sinh(x)).*(-x.*sin(x)-x.*sinh(x))-(cos(x)-cosh(x)).*(x.*cos(x)-x.*cosh(x))
plot(x, y, 'b-');
grid on;
cetingrdk
cetingrdk 2020 年 5 月 2 日
編集済み: cetingrdk 2020 年 5 月 2 日
No sir, its my graduation project.I can show you other way.And I have 6 more same problems like that.If you show me how can I solve, I can solve others sir.
[sin(x)-sinh(x) cos(x)-cosh(x) ; x*cos(x)-x*cosh(x) -x*sin(x)-x-sinh(x)]
this is the other form.
And I want to find to roots of this determinant.I need 6 roots at least.Please help me sir.

サインインしてコメントする。

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 5 月 3 日
編集済み: Ameer Hamza 2020 年 5 月 3 日
There is no direct way to find all the roots of such an equation. It is quite complicated, so solve() isn't able to find a closed-form expression (it might not exist since wolfram alpha also didn't return any). So your only option is to use a numerical solver like fsolve(). However, the output of fsolve() depends on the initial guess. We need to use some heuristics based on your function values to handle the problem of finding the initial guesses.
If we start by simply plotting you function over some range, it is not obvious how can we proceed
f = @(x) (sin(x)-sinh(x)).*(-x.*sin(x)-x.*sinh(x))-(cos(x)-cosh(x)).*(x.*cos(x)-x.*cosh(x));
x = linspace(0, 35, 10000);
plot(x,f(x))
However, the first step for finding the root of an equation is to find the zero-crossing points. So we can use sign() function to do that.
Each edge corresponds to a zero. As you can see, there are more than 6 roots for your equation.
Now we find the x-values at these zero-crossing points by taking the average of left and right x-values at the zero-crossing.
f = @(x) (sin(x)-sinh(x)).*(-x.*sin(x)-x.*sinh(x))-(cos(x)-cosh(x)).*(x.*cos(x)-x.*cosh(x));
x = linspace(0, 35, 10000);
ys = sign(f(x));
idx = find(diff(ys)); % find index of zero corssing points
x_zeros_left = x(idx); % left x-values at zero crossing points
x_zeros_right = x(idx+1); % right x-values at zero crossing points
x_zeros = (x_zeros_left+x_zeros_right)/2; % average x-values at zero crossing points
x_zeros = x_zeros(1:6); % select first 6 values to find out 6 roots
and then we write a for-loop and use these points as a starting guess for fsolve()
x_roots = zeros(1,6);
for i=1:6
x_roots(i) = fsolve(f, x_zeros(i));
end
To check if the roots we found are correct, check the function values at points in x_roots
for i=1:6
fprintf('Value of f(x) at x=%8.5f is %8.5f\n', x_roots(i), f(x_roots(i)));
end
Result
Value of f(x) at x= 0.00175 is -0.00000
Value of f(x) at x= 4.73004 is 0.00000
Value of f(x) at x= 7.85320 is -0.00000
Value of f(x) at x=10.99561 is 0.00000
Value of f(x) at x=14.13717 is 0.00000
Value of f(x) at x=17.27876 is 0.00000
  2 件のコメント
cetingrdk
cetingrdk 2020 年 5 月 3 日
thank you very much for all of yours sir.
Ameer Hamza
Ameer Hamza 2020 年 5 月 3 日
I am glad to be of help.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by