Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Solving a transcendental equation

180 views
Skip to first unread message

Faisal Siddiqui

unread,
Jul 17, 2009, 3:15:05 PM7/17/09
to
I want to solve a simple transcendental equation
cos(x)*cosh(x)+1=0

In order to do this I write the following in matlab;

syms x
eq='cos(x)*cosh(x)+1=0';
s=solve(eq)

It takes a long time & then returns;

s =

-212.05750411731104359622842837137

which obviously is not the correct answer, the correct answer is
x=1.87510

I am not sure what I am doing wrong, can someone please advise me how to correct this

Thanks

Matt Fig

unread,
Jul 17, 2009, 4:43:01 PM7/17/09
to
f = @(x) cos(x) * cosh(x) + 1;
fzero(f,2)
ans =
1.8751

Faisal Siddiqui

unread,
Jul 17, 2009, 5:30:18 PM7/17/09
to
"Matt Fig" <spam...@yahoo.com> wrote in message <h3qnol$f6g$1...@fred.mathworks.com>...

Can you please explain this a bit more, I am new to Matlab.

Thanks a lot for your help

Matt Fig

unread,
Jul 17, 2009, 5:43:01 PM7/17/09
to
>>docsearch anonymous
>>doc fzero

Faisal Siddiqui

unread,
Jul 17, 2009, 6:35:03 PM7/17/09
to
"Matt Fig" <spam...@yahoo.com> wrote in message <h3qr95$6h4$1...@fred.mathworks.com>...
> >>docsearch anonymous
> >>doc fzero

Thanks a lot for your kind guidance!!

However, the solution that Matlab provides to me with the "solve" command is incorrect as it does not satisfy the equation. Can you explain the reason please!!

Thanks again

Nathan

unread,
Jul 17, 2009, 6:39:04 PM7/17/09
to
On Jul 17, 3:35 pm, "Faisal Siddiqui" <aeroe...@gmail.com> wrote:
> "Matt Fig" <spama...@yahoo.com> wrote in message <h3qr95$6h...@fred.mathworks.com>...

> > >>docsearch anonymous
> > >>doc fzero
>
> Thanks a lot for your kind guidance!!
>
> However, the solution that Matlab provides to me with the "solve" command is incorrect as it does not satisfy the equation. Can you explain the reason please!!
>
> Thanks again

Well, you forgot to pass x into solve (how does it know what to solve
for?)
solve(eq,x) might work. Give it a try.
-Nathan

Andy

unread,
Jul 18, 2009, 9:39:05 AM7/18/09
to

I run into transcendental equations frequently, and understanding how
to solve one is a valuable tool. Matlab has some pretty fancy
functions, which might not always be available to you. I use matlab
all the time, but I have had only had one employer in 15 years which
was willing to pay for matlab, which is sad. Here is some pseudo code
to give a more generic means of solving. This can be used in Matlab,
or in any Basic or C programmer or Excel VBA.

tol=0.01 // set error tolerance
for the solver
inc=0.01 // set solver increment
amount

for k=-100 to 100 // set range accordingly
x=k*inc
if abs(cos(x)*cosh(x)+1)<=tol // check to see how close the
solver is - you're trying to drive the abs of the answer to zero
exit sub // if answer is
acceptable, jump out of loop
end if
x=x+1 // if answer is not close
enough, increment x
next

if x==100 // check to see if the
solver ran out of range
display("no solution found, increase range")
end if

display(x)

There are a lot of tricks/methods you can use to make the solver much
faster, more efficient, and more intelligent. This is about as basic
as you can get. Plotting the response will also yield a lot of
information. But to start, this is enough to get you started.

Faisal Siddiqui

unread,
Jul 18, 2009, 4:53:01 PM7/18/09
to
Andy <andrewk...@gmail.com> wrote in message <52b9b4d9-309a-4950...@h21g2000yqa.googlegroups.com>...
> On Jul 17, 4:39?pm, Nathan <ngrec...@gmail.com> wrote:

Thanks a lot for your help & guidance

nobert gerome

unread,
Dec 31, 2009, 7:57:03 AM12/31/09
to
I want to solve the same equation, but give me back 0, i don't understand why? somebody can explain to me my error???

"Faisal Siddiqui" <aero...@gmail.com> wrote in message <h3qqha$i91$1...@fred.mathworks.com>...

nobert gerome

unread,
Dec 31, 2009, 7:58:03 AM12/31/09
to
I want to solve the same equation, but give me back 0, i don't understand why? somebody can explain to me my error???

"Faisal Siddiqui" <aero...@gmail.com> wrote in message <h3qqha$i91$1...@fred.mathworks.com>...

Greg Heath

unread,
Jan 2, 2010, 2:17:30 PM1/2/10
to
On Dec 31 2009, 7:58 am, "nobert gerome" <kiki_jesp...@yahoo.fr>
wrote:

> I want to solve the same equation, but give me back 0, i don't understand why? somebody can explain to me my error???

>> solve('cos(x)*cosh(x)+1')
solve('cos(x)*cosh(x)+1','x')
x = solve('cos(x)*cosh(x)+1')
x = solve('cos(x)*cosh(x)+1','x')
ans =
1.8751040687119611664453082410782*i
ans =
1.8751040687119611664453082410782*i
x =
1.8751040687119611664453082410782*i
x =
1.8751040687119611664453082410782*i

Hope this helps.

Greg

lam

unread,
Jan 31, 2010, 6:34:02 PM1/31/10
to
hello, i also want to solve a transcendental equation as well and i am using the method below to solve equation. But, my project needs ten roots for the equation and i only can get the roots by entering the numbers 1 by 1. Is the any ways to finds all the 10 roots automatically?
f = @(x) cot(x) -0.9648*x;
> fzero(f,2)
> ans =
> 1.8751

Zachary

unread,
Apr 17, 2012, 12:50:07 PM4/17/12
to
method below to solve equation. But, my project needs ten roots for the equation and i only can get the roots by entering the numbers 1 by 1. Is the any ways to finds all the 10 roots automatically?
> f = @(x) cot(x) -0.9648*x;
> > fzero(f,2)
> > ans =
> > 1.8751


func=@(x)cos(x)*cosh(x)+1
count=1;
zerovec(1)=0;
numroots=10;
for i=1:50
newzero=fzero(func,i);
if count>=2
if abs(zerovec(count-1)-newzero)>1e-10 %throws near identical values
zerovec(count)=newzero;
count=count+1;
end
else %for first iteration
zerovec(count)=newzero;
count=count+1;
end
if length(zerovec)==numroots
break
end
end

Richa Saynak

unread,
Nov 20, 2016, 5:09:08 PM11/20/16
to
Hello, I am having difficulty in solving the below transcendental equation
tan((x^2+3)^0.5*0.01156) = 212.28/((x^2+3)^0.5)

I want many roots starting from the first root. As the the x in the above equation is my frequency. Please help me out.

Alan Weiss

unread,
Nov 21, 2016, 8:22:33 AM11/21/16
to
I suggest that you plot the function to know the approximate location of
roots, and then use fzero with two-element start intervals instead of
single-point start values.

Alan Weiss
MATLAB mathematical toolbox documentation

Karan Gill

unread,
Nov 21, 2016, 1:20:10 PM11/21/16
to
"Richa Saynak" wrote in message <o0t6tv$4dn$1...@newscl01ah.mathworks.com>...
> Hello, I am having difficulty in solving the below transcendental equation
> tan((x^2+3)^0.5*0.01156) = 212.28/((x^2+3)^0.5)
>
> I want many roots starting from the first root. As the the x in the above equation is my frequency. Please help me out.

You can also use "vpasolve".

eqn = tan((x^2+3)^0.5*0.01156) == 212.28/((x^2+3)^0.5)
vpasolve(eqn,x)
ans =
-322.15907387499457125526861341605

Adjusting the search range lets you discover more roots.

>> vpasolve(eqn,x,[0 100])
ans =
98.335311309383820046084349295995

To find all roots, see the "findzeros" function described here: https://www.mathworks.com/help/symbolic/solve-equations-numerically.html
0 new messages