Fit log10 function to data and determine the intercept
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi!
I have data that x is in log10 scale and y is normal. I want to fit a function that should follow the function: y = log10(1/x) + b, where b is the intercept or off set. How do I determine b here?
Sample data here:
x = 0.24. 0.6, 1.2, 2.4, 6, 12, 24
y = 17.2499, 9.8872, 5.6918, 2.7402, 0.6857, 0.1537, 0.0224
The function has be in the form of y = log10(1/x) + b.
Thank you in advance
0 commentaires
Réponses (1)
Star Strider
le 13 Avr 2021
If ‘b’ is the y-intercept, the easiest way is to interpolate:
x = [0.24, 0.6, 1.2, 2.4, 6, 12, 24];
y = [17.2499, 9.8872, 5.6918, 2.7402, 0.6857, 0.1537, 0.0224];
b = interp1(log10(1./x), y, 0);
figure
plot(log10(1./x), y)
hold on
plot(0, b, 'rs')
hold off
grid
legend('Data','b', 'Location','best')
text(0, b, sprintf('b = %.4f \\rightarrow ',b), 'Horiz','right', 'Vert','middle')
.
0 commentaires
Voir également
Catégories
En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!