|
Hello Steven,
Thanks a lot.
Actually i had given the value of m,
what i had not done was giving the variable name k in solve(),
Thanks Steven and Alan for the reply.
"Steven Lord" <slord@mathworks.com> wrote in message <gomftp$o1d$1@fred.mathworks.com>...
>
> "Kishore " <kishore3385@yahoo.co.in> wrote in message
> news:gomdl5$h8h$1@fred.mathworks.com...
> > Hello,
> >
> > I need to solve the following equation
> >
> > ' m + k*(1-log(k)) = 0 '
> >
> > the value of m is known.
> >
> > I tried the following
> >
> > declare k as a symbol. i,e syms k,
> > then, declare the equation eq = '' m + k*(1-log(k)) = 0 ';
> >
> > then use solve ( eq);
> >
> > But it just returns the plain expression -k+k*log(k),
>
> This is solving the question you asked, not the question you wanted
> answered.
>
> When you call SOLVE with just an equation, it has to figure out for which
> variables you want to solve. In this case, it solved for m in terms of k.
> In order to solve for k given a specific value of m, you need to do
> something a little different.
>
>
> syms k
> m = 0.5;
> equation = m + k*(1-log(k));
> solution = solve(equation, k)
> doubleSolution = double(solution)
> check = subs(equation, k, doubleSolution)
>
>
> Or you can solve the equation numerically with FZERO as Alan suggested.
>
> *snip*
>
> --
> Steve Lord
> slord@mathworks.com
>
|