要实现一下功能,这里$\bf{x}_i$为行向量
$${\bf{A}} = \left[ \begin{array}{l}
{{\bf{x}}_1}\\
{{\bf{x}}_2}
\end{array} \right],{\bf{h}} = \left[ \begin{array}{l}
{h_1}\\
{h_2}
\end{array} \right] \Rightarrow B = \left[ \begin{array}{l}
{h_1}{\bf{x}}_1^T{{\bf{x}}_1}\\
{h_2}{\bf{x}}_2^T{{\bf{x}}_2}
\end{array} \right]$$
>> A={[1 2] [2 3]}; h=[2 5]; X=cellfun(@(x)h(x)*A{x}\'*A{x},num2cell(1:2)\',\'un\',0); B = cell2mat(X) B = 2 4 4 8 20 30 30 45