|
From: | Pavel Hofman |
Subject: | Re: Custom jacobian (dfdp) in nonlin_curvefit - calling parameters? |
Date: | Sun, 17 Nov 2019 10:32:19 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
Hi Olaf, Dne 17. 11. 19 v 7:52 Olaf Till napsal(a):
On Sat, Nov 16, 2019 at 08:24:26PM +0100, Pavel Hofman wrote:I just wonder how the 2D case should be handled.The Jacobian function is called with the 'x' reshaped to a column vector (like 'x(:)' would do it). The output should be calculated for this column vector (one row for each element of the column vector and one column for each partial derivative).
Now I have for f (using the default real finite differences):f = @(p, x) ... where x is one row of indeps, and f returns two rows, each row for one equation (each equation uses all p elements). This code works OK.
If I wanted to use explicit jacobian to improve precision and calculation stability, please how should I handle the two equations in f and dfdp?
Something like this? The original row of x would be transformed to column twice the length, second half duplicate of the first one. f output = column vector where first half are outputs of the first equation (for the first duplicate of the original x), and the second half are outputs of the second equation (the the second duplicate of the original x).
Otherwise I do not know how to convert outputs of two equations to a single column vector of the same length as the indeps vector.
I very much appreciate your help. Best regards, Pavel.
[Prev in Thread] | Current Thread | [Next in Thread] |