Approximate a log curve as linear to predict a value

6 Ansichten (letzte 30 Tage)
Brian Robinson
Brian Robinson am 29 Mai 2020
Bearbeitet: Matt J am 29 Mai 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 Kommentare
Adam Danz
Adam Danz am 29 Mai 2020
What is this?
meanQ*K_p_1
Brian Robinson
Brian Robinson am 29 Mai 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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Matt J
Matt J am 29 Mai 2020
Bearbeitet: Matt J am 29 Mai 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-' )

Weitere Antworten (0)

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by