Hi. There is no need to address your question to individuals. Whoever can answer it will answer it.
Your problem is not a SOCP. Your first constraint type, ri <= norm( x-ai ,2) is going in the wrong direction to be convex. That is why you got an error message.
Also note that using vector variables will make your code simpler and easier to modify if you change the value of N. However you version is still correct (other than constraint type I mentioned going in the wrong direction).
@Mark_L_Stone Thank you very much!
The first constraint type whether I can covert into other type? such as change the equation or introduce other parameters for the constraint. I don’t understand the problem about the wrong direction well Thank you !