How do oscilloscopes and multimeters recognize waveforms?
Cheap multimeters make the assumption that waveform is a sinusoid and apply a multiplication factor to the peak value of the waveform. If you use them on any other waveform, the RMS reading will not be accurate.
Better devices like oscilloscopes uses the calculus definition of RMS and applies numerical integration to incoming samples over the past n samples (usually the samples displayed on the screen) to calculate RMS and average.
You can verify this by zooming in on the time scale so less than a full period of the waveform is on-screen and the calculated RMS and average will change. Then as you zoom out on the time scale and have more and more cycles on screen, the average and RMS readings will become more stable. That means that your RMS and average value calculations will be wrong if there are few cycles on the screen unless you have exactly an integer number of cycles on-screen. When you have many cycles on screen, it doesn't matter as much if the cycles on the edge of the screen get chopped off because they contribute proportionally less to the total sum/integral and therefore skew the result by less (see the equations at the bottom).
&quot;But what if it's not periodic?&quot; you ask? It doesn't matter; You can still calculate the RMS of any time block of waveform. You can calculate an RMS for any segment of waveform the same way you can calculate the average value for any sample of points. Remember, you can calculate the average for apple size if you wanted to, despite periodicity (and aperiodicty) being completely inapplicable to apples. You can actually calculate the RMS for apple size too, thought it won't carry much useful real world meaning.
There is no waveform recognition because very few real-world waveforms fall under a clear-cut mathematical definition.
In continuous time:
$$Average = \frac{1}{T}\int_0^{T}{f(t)dt}$$
$$RMS = \sqrt{\frac{1}{T}\int_0^{T}{f(t)^2dt}}$$
But in discrete time as would more likely be the case (i.e. a digital oscilloscope)
$$Average = \frac{1}{N}\sum_0^{N}{f(n)}$$
$$RMS = \sqrt{\frac{1}{N}\sum_0^{N}{f(n)^2dt}}$$
These are the generalized definitions of average and RMS and do not rely on knowledge of the waveform classification or periodicity.