problems coding to find function values
Mostrar comentarios más antiguos
Hello
I'm a biology student trying to use matlab, my mathematical and informatic knowledge is thereby limited. However I've tried to write some code to obtain the following:
I have a function y=f(t) that describes the growth of every individual. y=f(t) has 8 variables that are constant but are different for each individual. The velocity curve is obtained by differentiating the y=f(t) function. a picture of both the growth and velocity curve can be seen below. The red curve is the growth curve and the blue curve the velocity curve.
the function is described by y(t)= m1*(1-1/(1+(m2*(m0+m8))^m5+(m3*(m0+m8))^m6+(m4*(m0+m8))^m7)). t is here the independent variable. m1 to m8 are variables that are constant for each individual but differ between individuals.
What I would like to obtain is -the inflection points (both t and f(t) values) of the growth function - the asymptotic value of the growth function - the corresponding maximum height of the differentiated function - the minimum height of the differentiated function before the maximum height is reached

If tried to write some code trying to obtain all the information listed above. However there seem to be some bugs. If anybody is willing to help me out I would be very gratefull
if true
% code
% set variabelen
syms t;
m1=xlsread('jongens0','A1:A10');
m2=xlsread('jongens0','B1:B10');
m3=xlsread('jongens0','C1:C10');
m4=xlsread('jongens0','D1:D10');
m5=xlsread('jongens0','E1:E10');
m6=xlsread('jongens0','F1:F10');
m7=xlsread('jongens0','G1:G10');
m8=xlsread('jongens0','H1:H10');
% set loop
for i=1:10
% define function and differentiated function
y(i)=m1(i).*(1-1./(1+(m2(i).*(t+m8(i))).^m5(i)+(m3(i).*(t+m8(i))).^m6(i)+(m4(i).*(t+m8(i))).^m7(i)));
dy(i)=diff(y(i))./dt;
% information extraction
a=max(dy(i));
b=fminsearch(dy(i),x0,[0,a]);
c=max(y(i));
d=limit(y(i),inf);
e=inflect_pt((y(i)));
A = [a b c d e]
% write information to excel
xlswrite('output0',A)
end
1 comentario
Muthu Annamalai
el 19 de Jun. de 2013
Editada: Muthu Annamalai
el 19 de Jun. de 2013
Good progress sofar! You seem quite close to your said target.
You want to lookup the following functions, in MATLAB,
- doc diff %- to differentiate a signal to identify its maxima, minima, etc
- doc min %min and max of a signal/vector
- doc max %max
- doc abs %absolute value
- doc interp1 %interpolate the signal for better derivates - advanced use -Using a combination of these functions you should be able to find inflexion points or derivatives.
Goodluck.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!