Function handle in a if statement
Ältere Kommentare anzeigen
Hi everyone, I am trying to solve a complex ode equation with if statement meanwhile some expression is a function of a and T. However Matlab doesn't seem to like my expression in the if statement. Can I know what is wrong with my expression? Thank you for everyone's help!
T_g =@(a,T) ((lambda_Tg_grind.*a(T_g1_grind - T_g0_grind))./(1 - (1 - lambda_Tg_grind).*a)); + T_g0_grind;
delta_Tg = @(a,T) T - T_g;
% Find Activation energy for k1 and k2
mER1_g = @(a,T) -((T_g.^2).*(c1./c2)).*8.314;
mER2_g = @(a,T) -((c1.*c2.*(T_g + delta_Tg).^2)./(c2 + delta_Tg).^2).*8.314;
k1_grindling = @(a,T) A1_grind*exp(mER1_f/T); % are they different?
k2_grindling = @(a,T) A2_grind*exp(mER2_f/T);
% T_g conditions
Condition = @(a,T) T_g + delta_Tg;
if isoTemp > Condition % THIS LINE
k_2d = @(a,T) k_2d.*exp(mER2_g.*((1./T) - (1./(T_g - delta_tg))));
elseif T_g <= isoTemp && isoTemp <= Condition
k_2d = @(a,T) k_2d_tg.*exp((c1.*(T - T_g))./(c2 + (T - T_g)));
elseif isoTemp < T_g
k_2d = @(a,T) k_2d_tg.*exp(mER1_g.*(1./T - 1./T_g));
end
To explain a bit about my code and problem:
a is waiting to be solved in later lines by ode15i where T is the input. And the error that I have is: (highlighted in above %THIS LINE)
Undefined operator '>' for input arguments of type 'function_handle'.
Error in BlackBox (line 323)
if isoTemp > Condition
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!