# When to use 10 log 10 and 20 log 10 while calculating psnr of image ?

284 views (last 30 days)
prashali deshmukh on 15 Jan 2018
Edited: John BG on 21 Jan 2018
Difference between 10log10 and 20log20 can anyone please explain?

Star Strider on 15 Jan 2018
Whether you use 10 or 20 in calculating decibels depends on the units you are starting with. If you are starting with power, use 10, because power is already the square of amplitude. If you are starting with amplitude (or ‘energy’), use 20.

John BG on 15 Jan 2018
Edited: John BG on 21 Jan 2018
Hi Prashali Deshmukh
.
1. in MATLAB there is no log20
indeed one can write a function with such name but the only related built-in functions are log log2 and log10
2.
log10 is used to compress a reference axis so the relevant data shows up, so it's easier to spot, like RF signals in noise.
3.
the 10*log10 or 20*log10 is just to further amplify the data, according to whether you are measuring
• Amplitude: Voltage or current (Volts Amperes), or
• Power (Volts)^2 (/R) or I^2 (*R)
the reference resistor is usually of well known value, in my applications assumed 1, so one calculates the Watts per Ohm.
thanks in advance for time and attention
John BG

Image Analyst on 15 Jan 2018
Use the built-in psnr() function, in the Image Processing Toolbox. Optical images have units of gray levels which are most like a unit of energy, not power. Work out the units from first principles and you'll see. But it depends on how you interpret it.

### Categories

Find more on Image Quality in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!