How can I find the coefficients of a polynomial equation for fit the curve in MATLAB?
    3 views (last 30 days)
  
       Show older comments
    
    yahya rezvani
 on 10 Aug 2020
  
    
    
    
    
    Commented: hosein Javan
      
 on 10 Aug 2020
            hello. my polynomial equation is  ( V)=c0+c1*T+c2*(t^2)-c3*P-c4*P*T      i want use data for find c0 ,c1, ...c4  coefficients (i want fit data with this equation)
my p,v,t data is 
100000 , 0.956 , 19.4
100000 , 0.9717 , 71.1
10000000 , 0.959 , 41.8
80000000, 0.9725 , 161  ...
thank you.
2 Comments
  Image Analyst
      
      
 on 10 Aug 2020
				Hosein, can you move this down to the Answers section below, rather than up here in Comments, which is used to ask people for clarification of their question.  You can even earn credit if it's down there.
Accepted Answer
  hosein Javan
      
 on 10 Aug 2020
        if "p" and "t" are both independant variables then your problem is in the form of "y=f(x,z)" or "v=f(p,t)".
x=[
    19.4
    71.1
    41.8
    161
    180
];  % t
y=[ 
    100000
    100000
    10000000
    80000000
    100000000
];  % p
z=[
    0.956
    0.9717
    0.959
    0.9725
    0.9999
];  % z
sf = fit([y, x],z,'poly21')
plot(sf,[y,x],z)
look at command window,
sf(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y
V(t,p) = c0   +c1*T  - c3*P +c2*(t^2)  - c4*T*P  
 by comparing you will understant that:
c0=p00
c1=p10
c3=-p01
c2=p20
c4=-p11;
0 Comments
More Answers (0)
See Also
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!

