MATLAB: How to evaluate a cell array of handle functions

handle functiontga

Hi guys,
Sorry, I am quite new in Matlab and I am having a really hard time to get what I want. I developed a cell array of handle functions. The script looks like:
syms n Ea R r pO2 T t A
for k=1:N
Now, I need to evaluate each handle function for the syms parameters. There is not problem for n Ea r R PO2 and A as they are constant and the same for each handle function. The problem is that each handle function depends on Temperature and time. Each handle function must be evaluated at different temperature for the whole range of time. Therefore, T and t are vectors. These are T=[798 823 908 943] a temperature for each function handle and t=60:60:53940.
How could I evaluate each handle function in the cell array for the require temperatures and times with the rest of the parameters as constants?
Thank you in advance.
Best regards,

Best Answer

You can write your code, like this. This also avoid syms and makes your code faster.
T = [798 823 908 943];
t = 60:60:53940;
N = length(T);
% since these are constants define them first. No need to define as sym, it
% will makw your code fast.
n = 1;
Ea = 1;
R = 1;
r = 1;
pO2 = 1;
A = 1;
output = cell(1,N);
theEquation = @(t, T) 1-(1./((1./(n-1)+(exp(-Ea./(R*T))*A.*t*((pO2).^r)))*(n-1)).^(1./(n-1)));
output{1} = theEquation(t, T(1));
output{2} = theEquation(t, T(2));
output{3} = theEquation(t, T(3));
output{4} = theEquation(t, T(4));
First, you need to correct the value of the constants.