Polynomial fitting with multiple variables and unequal matrix length

1 view (last 30 days)
Hi, Good day. Thanks in advance. I'm having problem with investigating relationship with some data. Say, A=1,2,3.. and for each A, there are 20 values of B and C correspond to B (I mean C depends on B). I can easily find a polynomial relationship between B and C but how can I create relationship between A, B and C? Please note that, I'm actually a new in Matlab, thus don't take it otherwise if the question seems somehow not appropriate.
In simple:
A=[1 2 3 4 5].
For A=1, B=[... ... ... 20 values] and C=[... ... ... 20 values]
For A=2, B=[... ... ... 20 values] and C=[... ... ... 20 values]
....
For A=5, B=[... ... ... 20 values] and C=[... ... ... 20 values].
Need to have a relationship between A, B and C.
Thanks again.

Answers (1)

Iain
Iain on 21 Aug 2014
It kinda depeneds how those variables interact.
A "simple" method is to use the polyfit function to get a suitable relationship, for each value of A, for B to relate to C. (Quadratic/cubic/whatever).
So you get, for A = 1, C = d + eB + fB^2-hB^4 (or whatever)
Then you have 5 "A" values, 5 d values, on which you can do the same again...
To get something like d = A/4 + 0.1; e = A^2/20
  1 Comment
Md Jahirul Islam
Md Jahirul Islam on 21 Aug 2014
Thank you very much Iain. It's helpful but could you please explain the last part a little more? Finally say, I've
A=[1
2
...
5] and
C=[ d1 + e1B + f1B^2 . .
d2 + e2B + f2B^2 . .
..
d5 + e5B + f5B^2 . .].
How can I get the relationship?
Thanks again.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!