Learn to use a rootfinder. Also, learn to use valid syntax. {} is not a valid class of parens in a mathematical expression in MATLAB. Also note the use of the .* and ./ operators as I used them here:
eq = @(al,k) ((al/k).*((sin(al).*cosh(al))-(cos(al).*sinh(al)))) - (1-(cos(al).*cosh(al)));
ezplot(@(k) eq(k,0.5),[0,50])
grid on
Your function is symmetric around zero, so I plotted only the positive branch. It appears there are multiple roots, probably infinitely many. If we plot it closer to zero, we can see that zero is a root, as well as a root near 4.
k = 0.5;
syms al
EQ = ((al/k).*((sin(al).*cosh(al))-(cos(al).*sinh(al)))) - (1-(cos(al).*cosh(al)));
The various plots I did indicated a few solutions. You can see some of them here:
vpasolve(EQ,al,4)
ans =
3.8530504836173137215418129889578
vpasolve(EQ,al,20)
ans =
19.622049610416241341178694174198
vpasolve(EQ,al,30)
ans =
29.051052025226241425009802190818
vpasolve(EQ,al,35)
ans =
35.335792082102904999018466450802
vpasolve(EQ,al,40)
ans =
38.477970385522512262745808241056
In fact, simply looking for zero crossings, we should find roots near each of the following locations:
x = 1:100;
y = double(subs(EQ,al,x));
xl = find(y(1:99).*y(2:100) < 0)';
There will be infinitely many roots, but they will be bracketed as follows:
[xl,xl+1]
ans =
3 4
7 8
10 11
13 14
16 17
19 20
22 23
25 26
29 30
32 33
35 36
38 39
41 42
44 45
47 48
51 52
54 55
57 58
60 61
63 64
66 67
69 70
73 74
76 77
79 80
82 83
85 86
88 89
91 92
95 96
98 99
Of course, there will be infinitely many solutions. In fact, we can see a pattern:
fzero(@(al) eq(al,k),[3 4])/pi
ans =
1.2265
fzero(@(al) eq(al,k),[7 8])/pi
ans =
2.2383
fzero(@(al) eq(al,k),[10 11])/pi
ans =
3.242
fzero(@(al) eq(al,k),[13 14])/pi
ans =
4.2439
So the m'th root (beyond the zero root) can be approximated reasonably well as
for integer m. This would make a very good starting value for any numerical scheme, such as fzero. Be careful, since for large values of m, the cosh and sinh terms will blow up, making any numerical computation in double precision impossible. Symbolic computations using vpasolve will be far more stable.
In fact, we can see that as m grows very large, that the root does approach my suggested approximation.
double(vpasolve(EQ,al,pi*(200+1/4))/pi)
ans =
200.249873456277
>> double(vpasolve(EQ,al,pi*(250+1/4))/pi)
ans =
250.249898747801
>> double(vpasolve(EQ,al,pi*(500+1/4))/pi)
ans =
500.249949356665
>> double(vpasolve(EQ,al,pi*(1000+1/4))/pi)
ans =
1000.24997467402
>> double(vpasolve(EQ,al,pi*(10000+1/4))/pi)
ans =
10000.249997467
A little mathematical effort would probably show this conclusion holds as m goes to infinity. I have to leave something to the student to prove though.