# Is it possible to get the value of 'A' in a table format of 11x4 dimension

2 views (last 30 days)
MINATI on 18 Apr 2019
Commented: Walter Roberson on 1 May 2019
function main
format long
Pr=0.72;
xa=0;xb=2;
solinit=bvpinit(linspace(xa,xb,11),[0 0 0 1 0]);
sol=bvp4c(@ode,@bc,solinit);
x=linspace(xa,xb,11);
sxint=deval(sol,x);
f0 = deval(sol,0);
P=f0(3);,Q=f0(5);
f=x.^2*(P/2)+x.^5*(P^2)/120-x.^3*(1/6)-x.^4*(Q/24)-x.^8*(P^3)*(13/40320)+x.^7*(P*Q)/1008+x.^7*(Pr*P*Q)/1680+...
x.^11*(P^4)*(229/13305600)-x.^10*(P^2)*Q*Pr^2*(1/40320)-x.^10*(P^2)*Q*Pr*(37/1209600)+...
x.^9*(P^2)/20160-x.^10*(P^2)*Q/22400-x.^9*(Pr*Q^2)/120960-x.^8*Q*Pr/13440+x.^8*Q/8064+x.^9*Q^2/72576;
g=1+x.*Q-x.^4*Pr*P*Q/8+x.^7*P^2*Q/56-x.^10*P^3*Q*Pr*(13/1209600)-x.^9*P*Pr^2*Q^2*(19/13440)-...
x.^8*P*Q*Pr^2/128- x.^9*P*Pr*Q^2/24192;
function res=bc(ya,yb)
res=[ya(1); ya(2); yb(2); ya(4)-1; yb(4)];
end
function dydx=ode(x,y)
dydx=[y(2); y(3); -3*y(1)*y(3)+2*y(2)^2-y(4); y(5); -3*Pr*y(1)*y(5)];
end
A = [x; sxint(4,:);g;E2]';
end
%%% Is it possible to get the value of 'A' in a table format of 11x4 dimension

Walter Roberson on 30 Apr 2019
Provided that the function is known to be a polynomial:
Let MD be the maximum degree that the polynomial could be.
X = linspace(0, 2, MD+1);
Y = f(X);
p = polyfit(X, Y, MD);
then f'(0) = p(end-1)
This will not work if f is not a polynomial.
If the actual degree is 1 more than MD, then it might work. If the actual degree is 2 or more than MD, then it will probably not work.
MINATI on 30 Apr 2019
oook
thanks Walter
Walter Roberson on 1 May 2019
Coefficient may be approximate. You can estimate the degree by looking at the number of leading coefficients that are approximately 0. You can also estimate by starting with a high degree fit and extracting the coefficient mentioned and then reducing the degree and examining again. When the coefficient changes drastically then you have gone one step too far.