help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

overdetermined systems


From: Nate
Subject: overdetermined systems
Date: 31 Aug 2001 12:10:51 +0500

I'm trying to solve an overdetermined system of nonlinear equations - a
hyperbolic location system. Leasqrs appears to want to tweak the
parameters to fit the data, rather than  estimating the solution best
fitting all equations. I suppose this is only a 1 part octave question
and 4 parts math, but how do I proceed from this point? (Yes, I know
f(x,p) doesn't run, but hopefully you can see what I'm trying to do. I
really want the two sensors in the pair to be parameters to the
function, but it doesn't seem to support that - and at any rate, the
sensor locations are givens, not to be estimated.)

Nate



global impact = rand(1,2);
global sensor = [-1,-1; 1, -1; 1,1; -1, 1];
global sensors = rows(sensor);
global equations = combinations(sensors,2);
global sensor_pairs = zeros(equations,2);
global dt = zeros(equations,1);

eqn_idx = 1;
for i = 1:(sensors - 1)
        for j = (i+1):sensors
                sensor_pairs(eqn_idx, 1) = i;
                sensor_pairs(eqn_idx, 2) = j;
                dt(eqn_idx) =     distance(impact,sensor(i,:)) 
                                - distance(impact, sensor(j,:));
                ++eqn_idx;
        endfor
endfor

function y = f(x, p)
        global sensor;
        sensor_a = sensor(p(1),:);
        sensor_b = sensor(p(2),:);
        y = distance(x, sensor_a) - distance(x, sensor_b);
endfunction

estimate = zeros(equations,2);
leasqr(estimate, dt, sensor_pairs, f);




-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]