# Re: nonlinear regression, nlinfit

• From: "Daniel Rönnow" <drw@xxxxxx>
• Date: Tue, 23 Aug 2005 11:11:12 -0400

Peter,

There is not really much code to send. I tried the very simple
function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function y_output=polynomtest(Beta,x_input)

a1=Beta(1)+i*Beta(2);
a3=Beta(3)+i*Beta(4);
y_output=a1.*x_input+a3.*x_input.*(abs(x_input).^2);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I have two vectors "r" and "m_sy" which both have the length 8192. I
get
the following result in Matlab.

>> beta=[1 0 .01 .01];;
>> [betaf,R,J] = NLINFIT(r,m_sy,'polynomtest',beta);
>> betaf

betaf =

1.0310 + 0.0093i
0.0093 - 0.0310i
-0.1068 - 0.4925i
-0.4825 + 0.1168i
>> size(R)

ans =

8192 1

>> size(J)

ans =

8192 4

>> CI = NLPARCI(betaf,R,J);
??? Error using ==> qr
Out of memory. Type HELP MEMORY for your options.

Error in ==> C:\MATLAB6p5\toolbox\stats\nlparci.m
On line 44 ==> [Q R] = qr(J,0);

Regards

Daniel

Peter Perkins wrote:
>
>
> Daniel Rönnow wrote:
>> My problem is about nonlinear models. I have a function
>>
>> Yi=f(Xi, param)
>>
>> where, "Yi" is the respons, "f" is a nonlinear function of a
> number
>> of parameters, "param" and and the stimuli, "Xi". "Yi" and "Xi"
> are
>> vectors of typical length 8192 or 16384. The number of
parameters
> is
>> typically 20 (the parameter values are quite well known). The
>> function "f" is relatively complex.
>>
>> I tried to use "nlinfit" in Statistics Toolbox 4.0. In a first
> test I
>> simplified "f" to 4 parameters, but "nlinfit" stopped the
search
>> without reaching the correct value, though the start value was
> close.
>>
>>
>> Using "nlparci" gave the error message "out-of-memory".
>
> Daniel, can you post your code, or some simplification of it? Your
> problem may
> be because (per the NLINFIT help)
>
> "MODELFUN is a function, specified using @, that accepts two
> arguments,
> a coefficient vector and the array X, and returns a vector of
> fitted
> Y values."
>
> whereas you have defined f with the opposite argument order.
> NLPARCI would
> certainly run out of memory if asked to compute a 16384x16384 cov
> matrix.
>
> - Peter Perkins
> The MathWorks, Inc.
>
.

## Relevant Pages

• Re: The need to call MmProbeAndLockPages
... maxim@xxxxxxxxxxxxxxxx http://www.storagecraft.com "Daniel" wrote in message ... Each CPU needs to access the other's allocated memory directly> through the bridge. ... >> Maxim Shatskih, Windows DDK MVP ...
(microsoft.public.development.device.drivers)
• Re: Memory Allocation, Low memory warning and Form showing
... Thank you very much Daniel, I updated the CF to SP3 and the problems ... > may save on memory but hurt on perf (since you are recreating the object ... >> Is there any difference to allocate an object in a class scope, ...
(microsoft.public.pocketpc.developer)
• Re: ASP Component Development Suggestions (VB6) ?
... Even though VB will have returned virtual memory to ... >(i.e. such that your ASP Session is not bound to a specific thread). ... >SP4, or IIS 6.0 ... >> Daniel C. Di Vita ...
(microsoft.public.vb.com)
• Re: Memory in Enterprise
... I thougth Enterprise edition can support more than 4GB or memory ... "Daniel" wrote: ... > George Schneider wrote: ... > Because Windows 32bit version cannot address more than 4GB of ram. ...
(microsoft.public.windows.server.general)
• interior-point algorithm
... I use the interior-point algorithm to minimize a function which depends ... I got an "Out of memory" message. ... I report the error message below. ... Type HELP MEMORY for your options. ...
(comp.soft-sys.matlab)