AM Modulation Index

Simple question. How do I find the modulation index of an AM signal in
GRC?

I believe I have to create my own block but I am stuck at making the
block find E min of the mod signal.

Any tips?

Thank you
Top Leo.