Approximate a log curve as linear to predict a value

5 次查看(过去 30 天)
Hello there,
I have the following code:
clf
P = [0.01; 0.1; 1; 3; 5; 10; 25; 50; 75; 90; 95; 97; 99; 99.9];
phi_1 = [5.28; 4.10; 2.82; 2.15; 1.82; 1.33; 0.59; -0.12; -0.72; -1.18; -1.42; -1.57; -1.81; -2.14];
Cs_1 = Cv_Q
K_p_1 = Cv_Q.*phi_1 + ones(length(phi_1),1);
Q_p_1 = meanQ*K_p_1;
semilogx(P, Q_p_1)
Which produces this curve
My plan is to approximate a line from P = 0.01 and P = 0.1 and then plot this line to predict the Q_p value at P = 0.01.
What is the best way to go about this?
Thanks,
Brian
  4 个评论
Brian Robinson
Brian Robinson 2020-5-29
Hi Adam,
meanQ = 2775
K_p =
4.76406175741670
3.92285098587282
3.01035116589301
2.53271454137233
2.29746068153379
1.94814434419777
1.42060538577194
0.914453141876893
0.486718851261359
0.158789228456116
-0.0123044877900973
-0.119238060443981
-0.290331776690195
-0.525585636528738

请先登录,再进行评论。

采纳的回答

Matt J
Matt J 2020-5-29
编辑:Matt J 2020-5-29
idx=(P<=0.1);
c=polyfit(log10(P(idx)),Q_p_1(idx),1);
semilogx(P, Q_p_1, P,polyval(c,log10(P)),'x-' )

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by