如何给出多个向量作为polyfit()函数的输入?

23 views (last 30 days)
Akash
Akash 2015年6月6日
Commented: Star Strider on 7 Jun 2015
I have a 27x3 matrix of three input variables and one corresponding vector(27x1) as output. I want a polynomial regression equation relating the inputs and the output. The polyfit function gives the following error when given the command: polyfit(input, output, 3)
Error using polyfit (line 48) X and Y vectors must be the same size.
I am new to matlab and so please bear with the noob question. If I am using the wrong function, please let me know the correct procedure for the same.
Thanks in advance,
2 Comments
Akash
Akash on 7 Jun 2015
Hello Mr Jan Simon,
Actually I have three values for X, i.e. X1, X2, X3, and the polyfit function takes only one vector as input. I want a relation between X1, X2, X3 and Y, so I combined X1, X2, and X3 into a matrix (input) with the variables as the columns and used this matrix as a single input value to the function polyfit. At this point the previously mentioned error appears. Thanks for answering

Sign in to comment.

Accepted Answer

More Answers (0)

s manbetx 845

Community Treasure Hunt

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

开始狩猎!