MATLAB Answers

Approximate a log curve as linear to predict a value

5 views (last 30 days)
Brian Robinson
Brian Robinson on 29 May 2020
Edited: Matt J on 29 May 2020
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 Comments

Show 1 older comment
Brian Robinson
Brian Robinson on 29 May 2020
Hi Are,
Cv_Q = 0.7129
Cs_Q = 2.0790
And that should read Q_p_1.
Brian Robinson
Brian Robinson on 29 May 2020
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

Sign in to comment.

Accepted Answer

Matt J
Matt J on 29 May 2020
Edited: Matt J on 29 May 2020
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 Comments

Sign in to comment.

More Answers (0)


Translated by