(Solved): 2. Write a Matlab function from scratch to convert a linear power value in Watts into decibel-miliw ...
2. Write a Matlab function from scratch to convert a linear power value in Watts into decibel-miliwatts ( \( \mathrm{dBm}) \). Write a corresponding function to convert back to linear units of Watts. Fully comment your code. a. Write an example script which demonstrates the use of each of your functions. Use your functions to calculate \( 20.5 \mathrm{dBm}+33 \mathrm{dBm} \) and display the resulting value. b. Include each of your Matlab files in your homework submission.
function for linear to dBm: function p_dbm = dbm(p_lin) % p_lin is the linear power value in Watts % p_dbm is the result of the functoin, power value in decibel-milliwats % power in bdm is 10 times log of linear power with base 10 divided by 1mW p_db