具有3或4个变量的C ++非线性多曲线拟合 [英] C++ Nonlinear multiple curve fitting with 3 or 4 variables

查看:140
本文介绍了具有3或4个变量的C ++非线性多曲线拟合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当然知道,有更多详细信息可以解决此问题.起初我只是想知道是否有人已经进行了这种回归之一...


系统说明:

这是具有3个线性直角轴(X,Y,Z)的机械手.

机械手的功能在于定位具有可变负载的重型零件.

由于负载(F),机械手将遭受机械偏转和扭转,结果将是定位误差(delta_x, delta_y, delta_Z).

增量被描述为带有参数的模型函数,将用于校正位置.换句话说,它将用作前馈调节.

模型功能的参数将在测量的帮助下确定.


模型函数可以是变量X,Y,ZF中的某种多项式:

 delta_x = f_x(X,Y,Z,F)

delta_y = f_y(X,Y,Z,F)

delta_z = f_z(X,Y,Z,F)




如果您需要更多信息,请让我知道!

非常感谢您!

解决方案

因此,您从4个参数(x,y,和z以及荷载F).您可能还需要考虑输入的运动矢量(方向和速度),因为我怀疑偏差(x,y,z)将是摆动运动,而不是静态运动!

无论如何,虽然已经很好地建立了一个(曲线)或两个变量(曲面)中函数的近似算法,但我不知道有两个以上函数的泛型算法.当然,从数学上讲,问题并没有什么不同,可以将两个变量的函数的近似算法推广到3个或三个以上的函数,但是为此可能很难找到现成的程序代码. >
更重要的是,如果您不熟悉所需的数学背景,则将很难设置系统并使之适合您的要求.

由于这些原因,您最好的方法实际上可能是完全不同的:训练人工神经网络(ANN)来完成任务! ANN具有任意数量的输入单位(每个输入值一个)和相等数量的输出值(每个所需/期望输出一个).该网站上有几篇关于人工神经网络的文章:您可能想搜索关键字反向传播"-我认为反向传播网络可能最适合您的问题.

您可以建立一个由3层神经元组成的网络:第一个应为每个输入包含一个单位:x,y,z,并可能包含运动矢量的3个分量(对应于速度的长度).第三层的每个输出包含一个单位:dx,dy,dz(移动可能还包含三个单位:vx,vy,vz).第二层可以具有任意数量的单位,但是您至少需要与输入或输出(即,两个数字中的最小值)一样多的单位,以防止信息丢失(实际上,我建议使用最大单位).两个或更多的数字-输入法可提供更快的训练和更好的结果.

不幸的是,自90年代以来,我一直没有使用过人工神经网络,因此在这一点上,我无法提供更多建议.但是此站点上有关反向传播网络的文章可能被证明是有帮助的.

P.S. -我建议使用人工神经网络的原因:
如上所述,如果您经过足够长时间和艰苦的搜索,可能会找到针对此类问题的优化算法.但是,我经常遇到类似的难题,我的经验是(a)您发现的问题永远无法真正解决您的问题(因此您必须努力使其适应问题),(b)获得实际代码要么需要付款(通常是付款)除非我们谈论的是成熟的数学库,否则这不是什么大问题,许可(通常是一个问题,尤其是因为许多开放"许可与工业环境中的使用不兼容),或者您只能获得二进制文件而不是源代码(这使得根据(a)进行调整变得更加困难),或者(c)不足以描述它是否能够解决您的问题.这三者往往更多.

人工神经网络的好处是:
1.围绕
的许多免费实现 2.几乎不需要数学知识
3.可以轻松适应不断变化的需求或新的投入和见解

所有这些似乎与您的情况有关.

缺点是
1.需要大量输入数据和时间来正确训练
2.您对解决方案空间的形状影响很小

第一个对您而言可能并不重要,因为您可以获取任意数量的输入样本,而您只需要训练一次即可.如果生成输入会花费很多时间或成本很高,那将是一个问题.

如果您甚至不知道如何影响其他算法中的解形状(例如样条近似),或者首先是什么形状,那第二个问题就不成问题了.根据我的经验,人工神经网络可以提供相当平滑的形状,我相信这对您有好处. 1)建立物理机械
2)确保可以移动到所有需要的位置
3)确保可以足够准确地测量控制位置
4)确保您可以足够准确地测量实际位置
5)用一堆负载(从羽毛到最大负载)校准该系统
5.1)承受负荷
5.2)移至具有适当粒度的网格内的所有可能位置
5.3)测量与理想位置的偏差
5.4)存储x,y,z,F-> delty_x,delta_y,delta_z表
6)一旦有了足够准确的数据,就可以在测量点之间进行插值
值班时

如果这对您的问题有什么好的解决方案,我完全不清楚.您必须确定这种方法是否完全可行.

请更明确地陈述您的问题,因为Sergey,Manfred和Stefan已经指出.

干杯
安迪

PS:不过,它不会计算任何分析曲线或形状.


Of course I know that there are more detailed information necessary to solve this problem. At first I just wanted to know if somebody already did one of this kind of regression...


Description of the System:

It´s a manipulator with 3 linear cartesian axles (X,Y,Z).

The function of a manipulator consists in positioning of heavy piece parts with variable loads.

Because of load (F) the manipulator will suffer mechanical deflection and torsion, and the result will be positioning inaccurancy (delta_x, delta_y, delta_Z).

The deltas are described as a model function with parameters, and will be used to correct the position. In other words will be used as a feed-forward regulation.

The parameters of the model function will be determined with the help of measurements.


The model functions could be some kind of polynomials in the variables X,Y,Z and F:

delta_x = f_x(X,Y,Z,F)

delta_y = f_y(X,Y,Z,F)

delta_z = f_z(X,Y,Z,F)




If you need further informations, please let me know!

Thank you very much!

解决方案

So you have a dependency of 3 values (deviation in x, y, and z) from 4 parameters (position in x, y, and z as well as load F). You might also want to consider the movement vectors (direction and speed) for input, since I suspect that the deviation(x, y, z) will be a swinging motion, not static!

In any case, while approximation algorithms for functions in one (curves) or two variables (surfaces) are fairly well established, I am not aware of a generic algorithm for functions of more than two variables. Of course, mathematically the problem is not that different, and it''s possible to generalize from approximation algorithm for functions of two variables to functions of 3 or more, but it may be difficult to find readymade program code for that.

More importantly, if you are not familiar with the required mathematic background, you will have a hard time of setting up a system and fitting it to your requirements.

For these reasons, your best approach may actually be something entirely different: train an Artifical Neural Network (ANN) to the task! An ANN has an arbitrary number of input units (one for each input value) and an equally arbitrary number of output values (one for each required/expected output). There are several articles on ANNs on this site: you may want to search for the keyword "backpropagation" - I think backpropagation networks may be best suited to your problem.

You could set up a network with 3 layers of neurons: the first should contain one unit for each input: x, y, z, and posssibly the 3 components of your movement vector (lenght corresponding to speed). The third layer contains one unit for each output: dx, dy, dz (and maybe 3 more for movement: vx, vy, vz). The second layer can have any number of units, but you need at least as many units as you have either inputs or outputs (i. e. the min of the two numbers) to prevent loss of information (in fact I would advise to use the max of the two numbers or more - IME that provides faster training and better results).

Unfortunately I haven''t been using ANNs since the 90s, so I can''t offer more advice at this point. But the articles on backpropagation networks on this site may prove to be helpful.

P.S. - my reasons for suggesting an ANN:
As mentioned above, you could probably find an optimized algorithm for this kind of problem, if you search for it long and hard enough. However, I am often confronted with similarly hard problems and my experience is that (a) what you find never really fits your problem (so you have to work to make it fit), (b) obtaining the actual code either requires payment (usually not a big problem unless we''re talking of full blown math libraries), licensing (more often a problem than not, especially because many ''open'' licenses are incompatible with use in industrial environments), or you get only the binaries rather than the source code (which makes it a lot harder to adapt according to (a)), or (c) isn''t described sufficently to tell if it even solves your problem. More often than not it''s all three.

The benefits of ANNs are:
1. Plenty of free implementations around
2. Requires little knowledge of math
3. can be easily adapted to changing requirements or new inputs and insights

All these appear to be relvant in your case.

The disadvantages are
1. Takes a lot of input data and time to train properly
2. You have very little influence over the shape of the solution space

The first may not be very important to you, as you can take an arbitrary number of input samples, and you only have to train once. It would be a problem if generating the input takes a lot of time or is costly.

The second is not a problem if you don''t even know about how to influence the solution shape in other algorithms (e. g. spline approximation), or what would be a good shape in the first place. In my experience ANNs provide rather smooth shapes, and I believe that''s good for you.


A shot into the dark:
1) build the physical machinery
2) make sure you can move to all needed positions
3) make sure you can measure accurately enough the controlled position
4) make sure you can measure accurately enough the actual position
5) calibrate that system with a bunch of loads from a feather to the max load
5.1) take a load
5.2) move to all possible positions within a grid of suitable granularity
5.3) measure the deviation from the ideal position
5.4) store that x,y,z,F --> delty_x, delta_y, delta_z tables
6) once you have accurate enough data, interpolate between the measured points
while on duty

If this is any good solution for your problem is completely unclear to me. You have to decide if such an approach is feasible at all.

Please state your problem more clearly as Sergey, Manfred, and Stefan already pointed out.

Cheers
Andi

PS: It does not calculate any analytical curve or shape, though.


这篇关于具有3或4个变量的C ++非线性多曲线拟合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆