having trouble with ode45
1 view (last 30 days)
Show older comments
Kelly Grissom
on 25 Nov 2015
Commented: Star Strider
on 26 Nov 2015
I have a 2nd order diff eq that I am solving using using the shooting method. When I run the code I get the error Error using pin_fin>nest Too many input arguments. I have no idea why I am getting this error so any help would be greatly appreciated. Thanks.
code
function BC_at_L = pin_fin(T0)
L = 0.1; %length of the pin in meters
R = 0.005; %radius of the pin in meters
k = 250; %thermal conductivity of the pin with units of Watts per
%meter per Kelvin (W/(m*K))
epsilon = 1; %emissivity
sigma = 5.67 * 10^-8; %Stefan-Boltzmann constant with units of Watts
%per meter squared per Kelvin to the fourth
%power (W/(m^2*K^4))
Qdot = 25; %rate of heat dissipation with units of Watts
A = pi*R^2; %cross sectional area of the pin with units of meters
%squared
Qb = Qdot/A; %heat flux at the base of the pin
U0 = -Qb/k;
[dTdx] = nest;
BC_at_L = ode45(@nest,[0 L], [T0 U0]);
function [dTdx] = nest
dTdx = zeros(2,1);
dTdx(1) = (2/(k*R))*epsilon*sigma*(T0^4);
dTdx(2) = U0;
end
end
0 Comments
Accepted Answer
Star Strider
on 25 Nov 2015
Your ODE function ‘nest’ has to take at least two input arguments where the first is the independent variable and the second is the variable of integration. Your ‘nest’ function takes no input arguments, and that is throwing the error. See the ode45 documentation Examples section for details. (I don’t understand your ‘nest’ function, so I can’t offer any specific solutions.)
4 Comments
Star Strider
on 26 Nov 2015
My pleasure.
What error are you getting? What ODE does ‘nest’ represent? If I understand what you’re doing (at least to some extent), we can probably get your code to work.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!