Getting a formula/function out of a finite pair of numbers
2 views (last 30 days)
Show older comments
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 +....
0 Comments
Answers (1)
Star Strider
on 20 May 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 Comments
Star Strider
on 20 May 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?
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!