What is wrong with this?

1 view (last 30 days)
mar vouz
mar vouz on 5 Jan 2016
Commented: mar vouz on 5 Jan 2016
Hey I wrote:
X=linspace (0,1,8)
Y=A (13:20,2)
(I had "A" form my last program)
P=polyfit (X,Y,7)
And it says error using polyfit X and Y vectors must be the same size! But they are same sized!!!I don't know what's wrong with it!

Accepted Answer

the cyclist
the cyclist on 5 Jan 2016
They have the same number of elements, but they are not the same shape. You need to transpose one of them.
  3 Comments
the cyclist
the cyclist on 5 Jan 2016
P=polyfit(X,Y.',7)
FYI, you could have found this by trying
docsearch transpose
which will turn up (among other things) this documentation page.
mar vouz
mar vouz on 5 Jan 2016
Thank you very much for your help!!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!