MATLAB: Tabulated Value for g

dataexcelextractgraphMATLABtabletabulate

t = [0 42];
initialcon = [0.637 0.0253 0.0249 0.0172 0.0491 0.241 4.84e-3 2.48e-4]; %should have 8
[t,y] = ode15s(@dSdT, t, initialcon, @dSdTplot); %function, time frame, initial condition
figure
plot(t, y)
title('Changing Concentration of Components Over Time')
xlabel('Time (h)')
ylabel('Concentration (g/L)')
legend({'Cellulose','Cellobiose', 'Glucose', 'Xylan', 'Xylobiose', 'Xylose', 'HMF', 'Furfural'},'Location','e')
grid
function [ f ] = dSdT(t,y)
c = y(1);
g2 = y(2);
g = y(3);
xn = y(4);
x2 = y(5);
x = y(6);
dCdt = -(r1) - (r2);
dG2dt = ((342.30/342.28)*(r1)) - (r3);
dGdt = ((180.16/162.14) * (r2)) + ((360.31/342.30) * (r3));
dXNdt = -(r4) - (r5);
dX2dt = ((282.24/264.22) * (r4)) - (r6);
dXdt = ((150.13/132.11) * (r5)) + ((300.226/282.24) * (r6));
dHdt = kh*g; %ADD MASS CHANGE

dFdt = kf*x; %ADD MASS CHANGE
f = [dCdt; dG2dt; dGdt; dXNdt; dX2dt; dXdt; dHdt; dFdt]; %dWdt
end
This is my code that I have set up for changing concetratons using ode15s. The file works absolutely fine (as I have no posted all the values of the file that are used to derive r1, r2 etc).
My question is how can I extract the data values of g (glucose)? I want to create a separate graph, preferentially on excel, where I can compare the concentration profile of glucose at different temperatures. I have taken the semi colon away from the g = y(3) term but all the values are posted as g= 0.5 g=0.45 g=0.4 etc so I cannot use this in excel. If someone could point me in the right direction for extracting this data I would be very grateful
Will

Best Answer

The [G] value appears to be the third value (row) in the ‘f’ vector, and so is the third column in ‘y’.
To plot it, try this:
figure
plot(t, y(:,3))
grid
If that gives you the result you want, then you know that ‘y(:,3)’ is [G].