Re: finding complex root from nonlinear equations with complex arguments



It didnt work out since LMFnlsq is written a bit differently (example given in the thread). LMFnlsq expects an equation file input ('res' in the example) But, what if the function isnt a polynomial and suppose i had y = c1*log(x) + c2/sinh(x) + c3*cosh(x).. I cant use polyval here.. My question is how would you have to modify the 'res' file in the example given by Miroslav to get c1, c2 and c3 from the command prompt rather than them being defined in the file itself. Kindly let me know.

Regards,
Venkat

"Steven Lord" <slord@xxxxxxxxxxxxx> wrote in message <gv1e10$a7t$1@xxxxxxxxxxxxxxxxxx>...

"Venkat raman Thenkarai Narayanan" <thavil@xxxxxxxxx> wrote in message
news:gv19el$jnf$1@xxxxxxxxxxxxxxxxxxxxx
Hi,
I'd like to know how to pass constants from the command line for the
"LMFnlsq" function. For example, you've a function y = x^3 + *x^2 +
c2*x + c3 and i want to pass the values c1, c2 and c3 from the command
line rather than specifying in the file itself. I am finding that the
function is not flexible in that regard. Can you tell me what i need to do
if i want to play around with different constants input from the command
line?

After a bit of searching, I found that LMFnlsq refers to this File Exchange
submission:

http://www.mathworks.com/matlabcentral/fileexchange/17534

That looks like it has a fairly standard "function function" style
interface. I'd probably write my M-file something like:


function coeffs = findTheCoefficients(coeffVector)
% Call this like:
% c = findTheCoefficients([2 3 4])
% for the problem y = x^3 + 2*x^2 + 3*x + 4

myObjectiveFunction = @(x) polyval([1 coeffVector], x);
coeffs = LMFnlsq(myObjectiveFunction, ...) % pass in whatever options you
want


POLYVAL accepts a vector of polynomial coefficients and a value and
evaluates the specified polynomial at that value.

--
Steve Lord
slord@xxxxxxxxxxxxx

.



Relevant Pages

  • Re: Debug.exe for win32
    ... Format is: n) e address t=n ... Display the debug registers. ... R DRx command. ... The help output can be limited by specifying the first letterof the ...
    (alt.lang.asm)
  • Re: Startup.cmd
    ... I can't recall ever having tested this in an OS/2 session with earlier versions of OS/2, but both eCS1.2 and MCP1 refuse to execute a hidden cmd or exe file. ... If it works in a DOS session, ... You can either set these options at the dir command or by ... However if a bat or exe file is hidden it can still be executed in the usual way by specifying its name on the command line. ...
    (comp.os.os2.bugs)
  • Re: How to get the application path
    ... I guess in the cases I use it, I always launch a program by specifying ... That is typically the case for launching from an icon, ... I'm enougb of a dinosaur that I still use command lines for ... the string refers to. ...
    (comp.lang.ada)
  • Re: finding complex root from nonlinear equations with complex arguments
    ... I'd like to know how to pass constants from the command line for the ... line rather than specifying in the file itself. ... function coeffs = findTheCoefficients ... POLYVAL accepts a vector of polynomial coefficients and a value and ...
    (comp.soft-sys.matlab)
  • Re: [opensuse] bash - why doesnt the tldp bash beginners guide for loop example work?
    ... loop from breaking on spaces by specifying that it only break on ... it was kind of comical when after running the script I had managed to loose the "ls" command. ... I'm not entirely sure it was the IFS, but I just logged out and logged back on and all was well. ...
    (SuSE)