Getting a formula/function out of a finite pair of numbers

2 Ansichten (letzte 30 Tage)
samir
samir am 20 Mai 2014
Kommentiert: Star Strider am 20 Mai 2014
Hi everybody.
I use a machine which is able to move in 3 dimensions( x , y , z ).I define the way how it should move with a finite pair of numbers. Almost always z( height ) is fixed, so only x and y are changing.
How can i get a formula/function f(x,y,z) out of this
for example: i give him a vector [x,y]=[(0,0) (0,4) (1,5) .... ]
how do i get this then:
f(x,y,z) = Ax^n +By^m +....

Antworten (1)

Star Strider
Star Strider am 20 Mai 2014
It looks to me that you have a matrix of (x,y) pairs, and that it is actually:
xy = [0 0; 0 4; 1 5];
A = ...
B = ...
n = ...
m = ...
f = @(xy) A.*xy(:,1).^n + B.*xy(:,2).^m + ...
That is how I would do it.
  2 Kommentare
samir
samir am 20 Mai 2014
Bearbeitet: samir am 20 Mai 2014
But how do i know how big is my n and m.I found a similar question
My question is about trying to find a formula between numbers. For example, suppose I have 10 numbers: 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 It is obvious that the first number plus 2 will yield the second number, 4; 4 plus 2 will yield the number 6, and so on. So the formula for this group of numbers is x + 2.
Say I have another set of numbers: 2, 6, 14, 30, 62..... If the first number is multiplied by 2 and 2 is then added, you will get 6. 6*2 + 2 will yield 14. 14*2 + 2 will be 30.. So the formula is x*2 + 2.
Star Strider
Star Strider am 20 Mai 2014
I have no idea what m and n are. I got the impression that you defined A, B, m and n, and that you wanted to know how to separate the elements of your matrix into x and y values in your function.
If you’re solving for m and n, you must already know the trajectory of the robot. Then this becomes a curve-fitting (parameter estimation) problem.
The illustration you described in your comment is exactly a parameter estimation problem, although in that situation using linear least squares. Yours appears to be a nonlinear system, so probably fminsearch would be the best way for you to determine n and m.
What is it you want to do?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by