Fit log10 function to data and determine the intercept
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Star Strider
am 13 Apr. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!