Look Up Table for position solver

2 Ansichten (letzte 30 Tage)
Chun Wai KO
Chun Wai KO am 26 Jan. 2022
Kommentiert: Chun Wai KO am 2 Mär. 2022
Dear all,
I am trying to build a look up table to solve the position. It is basically a voltage-position conversion problem.
I will define the position in cartesian coordinates (x,y,z)
Each point of the position will have 3 volatge measured.
For example, at (0,0,0) the voltage is [5,1,2]
and at (1,0,0) the voltage is [3,2,4]
i will have 1000 points data.
How can i generate a look up table that when the input is [?,?,?] voltage, the output is [x,y,z] coordinate.
For example if the input voltage is [3,2,4] then the output will be (1,0,0)
It is also okay to use simulink or matlab
Could anyone help me? Please~
Thank you ver much
  16 Kommentare
Torsten
Torsten am 27 Jan. 2022
Say you are to interpolate the position for the voltage vector that is half the voltage vector in position 1,0,0 plus half the voltage vector in position 1,0,1. Would it be acceptable to assume that the reverse interpolated position is 1,0,1/2 ?
Torsten
Torsten am 27 Jan. 2022
Bearbeitet: Torsten am 27 Jan. 2022
Concerning your idea:
Maybe
f(x,y,z) = v1
g(x,y,z) = v2
h(x,y,z) = v3
Three equations for contour in three unknowns x,y,z where f,g and h are the equations for the surface of voltage components 1,2 and 3.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Torsten
Torsten am 28 Jan. 2022
Bearbeitet: Torsten am 28 Jan. 2022
Use fmincon (or maybe better ga, since the objective function doesn't look differentiable) to solve the following problem:
min:( interp3(xdata,ydata,zdata,v1data,x,y,z) -v1q)^2 + (interp3(xdata,ydata,zdata,v2data,x,y,z)-v2q)^2 + ...
(interp3(xdata,ydata,zdata,v3data,x,y,z)-v3q)^2
for x,y,z under the constraints
0<=x,y,z<=10
Here, v1data,v2data and v3data are your voltages at (xdata,ydata,zdata) and (v1q,v2q,v3q) is the voltage combination for which you want to find the coordinates (x,y,z).
  11 Kommentare
Torsten
Torsten am 24 Feb. 2022
Bearbeitet: Torsten am 24 Feb. 2022
vq = 0.7;
y = [4.3827, 4.2624, 3.2585, 0.9934, 0.5985, 0.1775, 0.2299, 0.0952, 0.0935, 0.0954, 0.08];
fun=@(x) interp1(1:numel(y),y,x,'pchip') - vq;
x0 = 1;
[solution,res] = lsqnonlin(fun,x0,1,numel(y))
But you should really try ga instead of lsqnonlin.
Chun Wai KO
Chun Wai KO am 2 Mär. 2022
Dear sir,
I am trying to use the ga to build the 2D system
It can compute a solution but the output keeps varying. (not very accurate)
So i tried to set the options:
options = optimoptions(@ga,'FunctionTolerance',1e-16,'MaxGenerations',150,'MaxStallGenerations',150,'ConstraintTolerance',1e-16)
The output becomes more accurate
however, i found that the computation time for the ga is quite long for each output (1-2 seconds)
As my application is a real time tracking system, this situation is not ideal
is there any way to keep the accuracy while shortening the run time?
thank you very much

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by