I want to implement the recursive least square algorithm on PLECS, which requires matrix operation, but I can’t find the block of matrix generation and operation. I hope to get a reply

If the matrix coefficients are constants, you can use the Gain block for multiplying an incoming vector signal with a matrix (the ‘Mulitplication’ parameter needs to be set to ‘Matrix (K*u)’).

PLECS does not support matrices as signal values, it only supports vectors, so therefore there is no C=A*B operation where A,B, and C are matrices.

If the coefficients are variable over time or you need to determine the product of two matrices, then you need to unwrap the matrix multiplication using Sum and Product blocks.

Another alternative is to implement matrix multiplication in a C-Script or DLL Block. The DLL Block is not supported when generating code for the RT Box, so therefore the C-Script block would be the best choice. You will also likely need to go this route if you require computations beyond basic operations like addition/multiplication.

A good reference for matrix operations in a C-Script is the “Multistep Model Predictive Control for NPC Inverter Driving an Induction Machine” demo model in the RT Box demo model library.