Fit log10 function to data and determine the intercept
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Star Strider
2021-4-13
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Regression 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!