Fit log10 function to data and determine the intercept
4 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Star Strider
on 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 Comments
See Also
Categories
Find more on Regression in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!