I'm trying to construct a simple explicit example of a 'spectral measure'. Here is the definition I have.
Let $A$ be a bounded self-adjoint opreator. Let $\psi \in H$ where $H$ is a Hilbert space. Then $f\to (\psi,f(A)\psi)$ is a positive linear functional on $C(\sigma(A))$. Thus by the Riesz-Markov theorem there exists a unique measure $\mu_\psi$ on the compact set $\sigma(A)$ such that $$(\psi,f(A)\psi) = \int_{\sigma(A)} f(\lambda)d\mu_\psi.$$ $\mu_\psi$ is the spectral measure associated with $\psi$.
So take $H = \mathbb{R}$. Let $f(x) = x^2$ and let $$A=\begin{pmatrix}3 & 0 \\ 0 & 1\end{pmatrix}\quad \text{and} \quad \psi = \begin{pmatrix}1 \\ 1\end{pmatrix}, $$ which means $\sigma(A) = \{3,1\}$. Then
$$ \begin{align} (\psi,f(A)\psi) & = (\begin{pmatrix}1 \\ 1\end{pmatrix},\begin{pmatrix}3 & 0 \\ 0 & 1\end{pmatrix}^2\begin{pmatrix}1 \\ 1\end{pmatrix}) \\ & = (\begin{pmatrix}1 \\ 1\end{pmatrix},\begin{pmatrix}9 & 0 \\ 0 & 1\end{pmatrix}\begin{pmatrix}1 \\ 1\end{pmatrix}) \\ & = 9 + 1 = 10. \end{align} $$
So we should have $$ \int_{\sigma(A)} f(\lambda)d\mu_\psi(\lambda) = \int_{\{3,1\}} \lambda^2 d\mu_\psi(\lambda) = \text{something...} = 10. $$
But what is this 'something'? To be precise, what is an explicit expression for $\mu_\psi$ and then how do I interpret an integral over the discrete set $\{3,1\}$ with respect to this measure $\mu_\psi$?
The integral is (by definition of Lebesgue integral) $$\tag1 \int_{\{3,1\}}f(\lambda)\,d\mu(\lambda)=f(3)\,\mu_\psi(\{3\})+f(1)\,\mu_\psi(\{1\}). $$ This is supposed to agree with $$\tag2 \langle \psi,f(A)\psi\rangle=f(3)+f(1). $$ As $(1)$ and $(2)$ are agree for all $f$, we get $\mu_\psi(\{3\})=\mu_\psi(\{1\})=1$.
In this example, because the form of $A$ is so simple, one can calculate the spectral measure and thus obtain $d\mu_\psi$ for any $\psi$. Because $$ f(A)=f(3)E_{11}+f(1)E_{22}=\int_{\sigma(A)} f(\lambda)\,d\mu, $$ where $\mu$ is the spectral measure $\mu(\{3\})=E_{11}$, $\mu(\{1\})=E_{22}$. And then $$\tag3 \mu_\psi(R)=\langle \psi,\mu(R)\psi\rangle $$ for any Borel set $R\subset \sigma(A)$ (in this case the only possibilities are $\varnothing$, $\{1\}$, $\{3\}$, $\{1,3\}$).