Finding the difference in growth rate between graphs
Ältere Kommentare anzeigen
I have two set of graphs as follows:
x=[6,12,24,48,72,96];
control_vals=[126,363,672,1014,1358,1526];
test_vals=[83,43,112,412,714,826];
plot(x,control_vals,'*-','Color','k')
hold on
plot(x,test_vals,'o-','Color','r');title('G1')
ylim([0 2000]);hold off
control_vals2=[101,151,338,892,1142,1341];
test_vals2=[73,176,425,769,1021,1288];
figure;plot(x,control_vals2,'*-','Color','k')
hold on
plot(x,test_vals2,'o-','Color','m');title('G2')
ylim([0 2000]);hold off
I need to find out if the rate of growth is same between G1 control vs G2 control and G1 test vs G2 test.
I have tried out using curve fitting to approximate the above curve and using derivatives to find the answer but I'm getting some errors.
% For G1 Test (Red Curve in G1)
% Eq: y = - 0.003056992404*x^{3} + 0.4690737455*x^{2} - 9.431674809*x +
% 110.8789328 - Obtained using Interactive Fitting in MATLAB
p=[- 0.003056992404 0.4690737455 -9.431674809 110.8789328];
q = polyder(p)
tspan=[0 100];
y0=0;
[t,y]=ode45(@(t,y) (-0.0092*t^2+0.9381*t-9.4317),tspan,y0);
figure;plot(t,y);title('G1 Test- Differentiation')
% For G2 Test (Magenta Curve in G2)
% Eq: y = 0.000966*x^{3} - 0.2096*x^{2} + 25.49*x - 83.89 - Obtained using Interactive Fitting in MATLAB
p1=[0.000966 -0.2096 25.49 -83.89]
q1=polyder(p1)
[t,y]=ode45(@(t,y) (0.0029*t^2-0.4192*t+25.49),tspan,y0);
figure;plot(t,y);title('G2 Test- Differentiation')
Can someone guide me on the right method to find the difference in growth rate between these curves?
Appreciate your help in advance!
4 Kommentare
Jon
am 6 Jun. 2022
When you say "I have tried out using curve fitting to approximate the above curve and using derivatives to find the answer but I'm getting some errors." Please be specific and cut and paste the entire error message so other can see it.
In general, how are you defining "growth rate". Often the growth rate refers to the time constant in an exponential growth model. If this is how you are defining growth rate then you have to fit an exponential model to the data not a polynomial. If by growth rate you simple mean the instantaneous rate of change of the value, then fitting a polynomial and differentiating it seems like a reasonable approach. Be careful to use as low an order polynomial as you can othewise you will have spurious "ups and downs" in your fitted values which will lead to positive and negative derivative values.
Jon
am 14 Jun. 2022
Can you please be more specific about the errors? When you say " when I try to find the derivate of the aferomentioned curves, I get some errors either due to ODE solver or some other issue", what exactly goes wrong. Please cut an paste any error messages
Aravind S
am 15 Jun. 2022
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Spline Postprocessing 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!












