---
title: "Fit y = ln(ax + b)"
subject: "Numerical Method"
chapter: 4
key: "semester_4/numerical_method:fit-log-ax-b"
source: https://www.bctengineer.com/q/semester_4/numerical_method/fit-log-ax-b
site: BCT Engineering
---

# Fit y = ln(ax + b)

Numerical Method · Chapter 4: Interpolation

- Asked in: 2070 Magh, 8 marks
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/numerical_method/fit-log-ax-b
- Whole chapter: https://www.bctengineer.com/md/semester_4/numerical_method/chapter-4

## Question

Fit the following data to the curve y = log_e(ax + b).
| x | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|---|
| y | 0.9 | 1.0 | 1.5 | 1.9 | 2.1 | 2.4 | 2.5 |

## Short answer

Linearize by taking exponentials: Y=e^y = ax+b. Fit with least squares normal equations to get a=1.7665, b=1.5172. The fitted curve is y = ln(1.7665x + 1.5172).

## Answer

Take the exponential of both sides: y = ln(ax + b) → eʸ = ax + b. Put Y = eʸ, so Y = b + ax is a straight line in x.

| x | y | Y = eʸ | x² | xY |
|---|---|---|---|---|
| 0 | 0.9 | 2.4596 | 0 | 0.0000 |
| 1 | 1 | 2.7183 | 1 | 2.7183 |
| 2 | 1.5 | 4.4817 | 4 | 8.9634 |
| 3 | 1.9 | 6.6859 | 9 | 20.0577 |
| 4 | 2.1 | 8.1662 | 16 | 32.6647 |
| 5 | 2.4 | 11.0232 | 25 | 55.1159 |
| 6 | 2.5 | 12.1825 | 36 | 73.0950 |
| Σ |  | 47.7173 | 91 | 192.6149 |

#### Normal equations (intercept b, slope a)

```text
ΣY = n·b + a·Σx      →  47.7173 = 7b + 21.0000a
ΣxY = b·Σx + a·Σx²   →  192.6149 = 21.0000b + 91.0000a
```

Solving: a = (nΣxY − ΣxΣY)/(nΣx² − (Σx)²) = 1.7665,  b = (ΣY − aΣx)/n = 1.5172.

**Answer: y = ln(1.7665x + 1.5172)**  (check: x = 6 gives 2.495 against 2.5; x = 0 gives 0.417 against 0.9).

This fits the straight line to eʸ rather than minimising the error in y itself, which is the usual exam method.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How is y = ln(ax + b) linearised?
   A. Divide by x
   B. Square it
   C. Take log of y
   D. Take exponent: e^y = ax + b
   Answer: D. Y = e^y is linear in x. (Key point: Linearisation)

2. Which equation is right for Y = b + ax?
   A. ΣY = na + bΣx
   B. ΣY = aΣx²
   C. ΣY = ab
   D. ΣY = nb + aΣx
   Answer: D. b is the intercept, a the slope. (Key point: Normal equations)

3. What limitation does the answer note?
   A. It cannot be solved
   B. It fits e^y, not y itself, so error in y is not minimised
   C. It fits only 3 points
   D. It needs equal spacing
   Answer: B. This is the usual exam method; the fit at x = 0 is poor. (Key point: Limitation)

## Close variants set in other exams

- [Fit curve y = a x^b (A)](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Afit-y-ax-b) — Numerical Method, chapter 4, asked 2×

## Related in Numerical Method

- [Fit y = ax/(b + x)](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Afit-y-ax-over-b-plus-x) — Numerical Method, chapter 4, asked 2×
- [Fit curve y = a b^x (decay data)](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Afit-y-abx-d) — Numerical Method, chapter 4, asked 3×
- [Fit y = a b^x (growth data)](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Afit-y-abx-d2) — Numerical Method, chapter 4
- [Least squares: y = ax + b + c/x](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Aleast-squares-ax-b-c-over-x) — Numerical Method, chapter 4
- [Fit y = a b^x and find y(7)](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Afit-y-abx-y7) — Numerical Method, chapter 4, asked 2×
- [Quadratic least squares fit](https://www.bctengineer.com/question.md?key=semester_4%2Fnumerical_method%3Aquadratic-fit-least-squares) — Numerical Method, chapter 4

## Related in other subjects

- [Least squares fit for calibration data](https://www.bctengineer.com/question.md?key=semester_3%2Fmetrology%3Aleast-squares-calibration-line) — Metrology, chapter 2
- [Demagnetizing via B-H curve; data storage material](https://www.bctengineer.com/question.md?key=semester_3%2Felectrical_engineering_material%3Ademagnetize-bh-curve-storage) — Electrical Engineering Material, chapter 4
- [Presentation of precipitation data, IDF curve](https://www.bctengineer.com/question.md?key=semester_5%2Fengineering_hydrology%3Apresent-precip-data-idf) — Engineering Hydrology, chapter 2
- [DAD curve procedure and isohyetal area data](https://www.bctengineer.com/question.md?key=semester_5%2Fengineering_hydrology%3Adad-curve-procedure-isohyetal) — Engineering Hydrology, chapter 2
