How do I solve for a variable inside an integral when part of my integral is a vector of polynomial coefficients?

10 views (last 30 days)
I'm attempting to integrate a large expression that is composed of several functions of the integration variable and includes an additional variable that must be solved for. One of the functions that make up the integrand is not directly a function of the integration variable, but rather is specified by a vector of polynomial coefficients determined by a QR factorization method used earlier. I have tried defining a function of two variables to be integrated as shown below. At first I was getting errors stating that I should use .^ instead of ^, so I put dots before any operations that might need them. After I did this I get a message that says matrix dimensions must agree.
Here is my code. abeg and bend are scalars and a is the coefficient vector. I use quad to numerically integrate, and fzero to find solutions.
function [ Ts ] = FindTs(abeg, bend, a) D=1.95/12; m=25; T1=70; T2=360; L=5; func=@(t,ts) (m/(pi*D)).*((0.26+t.*3.55e- 5)-14500./(t+460).^2)./(heat_trans(a,t).*(ts-t));
f=@(ts) L-quad(@(t) func(t,ts),T1,T2); Ts=fzero(f,[abeg bend]) end
function [cp]=specific_heat(T) cp=0.26+(3.55e-5).*T-14500/(T+460).^2; end
function [mu]=viscosity(T) mu=0.0333.*((T+460)./460).^0.935; end
function [h]=heat_trans(a,T) k=mypolyval(a,T); cp=specific_heat(T); mu=viscosity(T); h=0.023.*k./(1.95/12).*((100/(pi.*(1.95./12).*mu)).^0.8).*(mu.*cp./k).^0.4; end
function [ pv ] = mypolyval( a,x )
m=length(a); pv=a(1); for k=2:m pv=pv.*x+a(k); end
end
I feel like the problem must be with the way I handle the heat_trans function, but I'm not sure. Is there some way to directly use the coefficients in my evaluation of the integral? If you see any problems with what I am doing, I would appreciate your help. Thanks!

Answers (0)

Community Treasure Hunt

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

Start Hunting!