From: lam on
Andy <andrewkgentile(a)gmail.com> wrote in message <52b9b4d9-309a-4950-b54e-8a119971deb5(a)h21g2000yqa.googlegroups.com>...
> On Jul 17, 4:39 pm, Nathan <ngrec...(a)gmail.com> wrote:
> > On Jul 17, 3:35 pm, "Faisal Siddiqui" <aeroe...(a)gmail.com> wrote:
> >
> > > "Matt Fig" <spama...(a)yahoo.com> wrote in message <h3qr95$6h...(a)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
>
> 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.
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