how can Integrate polyfit in matlab ? ?
Show older comments
Hi , I have problem when i try to integrate polyfit in matlab and what I need to do is To fit the data (x and y are two vecore with the same file ) to a polynomial of degree n where n is the number of elements of x then integrate the polynomial analytically between the first and last values of x and assign this integral as I_analytical,
what i tried is this
p2= polyfit(x,y,length(x));
firstX = x(1);
LasttX = x(length(x));
value = integral(p2,firstX,LasttX);
but it didnt work correctly I got
Error in poly_integral (line 5)
value = integral(p2,from,to);
Any idea please ? ? ?
1 Comment
Star Strider
on 8 Jan 2017
My Answer:
Left Unsaid:
‘I can't ,I must do it like what it is above I have to fit the data to a polynomial of degree n where n is the number of elements of x, then integrate the polynomial analytically between the first and last values of x and assign this integral as I_analytical,’
Answers (0)
Categories
Find more on Polynomials in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!