# How to extract -3 dB diameter from Matrix?

9 views (last 30 days)
Jonas on 25 Jan 2021
Answered: Kelly Kearney on 25 Jan 2021
After taking measurements I get a two-dimensinal matrix of measurement values where the position in the Matrix corresponds to the position the measuerment was taken at. From this data I want to get the minimal and maximal -3 dB (Signal at 1/2 strenght) diameter, where 0 dB is the point in the Matrix with the maximal value.
Getting the curve through all points at -3 dB can be done with this:
[M, c] = contour(Matrix, [maxVal/2, maxVal/2]);
But I do not know how to continue with this. I thought about "slicing" the matrix with a number of lines through the maxVal-point at different angles and to then find the distance of the two points at the intersections of the line and the curve. But this does not seem to be a nice solution.
Is there an easier or more elegant solution?
The -3 dB-curves are usually ellipses.

Kelly Kearney on 25 Jan 2021
The coordinates of the contour line are saved in the c matrix, albeit in a less than user friendly format. I like using the contourcs function to get the values into a more usable format.
Once you have the coordinates, you could apply an ellipse-fitting routine to each contour line; there are a bunch of those available on the File Exchange too. The resulting ellipses will have associated parameters for their major and minor axis lengths and rotation.

R2020b

### Community Treasure Hunt

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

Start Hunting!