hello,everyone.do you know how can i express ||(a,b)||2 in matalb?(a is number,b is matrix)
i know ||(a)||2 is norm(a,2),but how can i express ||(a,b)||2?
please help me,thanks.
norm squared can be entered as square_pos(norm(...))
Edit: On 2nd thought, it looks like I have misinterpreted the question. I don’t know what you’re asking. Pretend a
and b
are just numerical MATLAB variables (not CVX variables or expressions). What would the MATLAB expression be to evaluate what you’re interested in? If a
is a scalar and b
is a matrix, what (mathematical object) is (a,b)
? Perhaps you should give an example for some small matrix b
.
a,b are variable,but it is different to express them,when they are others??
I don’t understand your last post.
Give an example where a
and b
are numbers,and show us what (a,b)
is supposed to be in that example.
variable a(a is matrix of 1*1),variable b(b is matrix of 20 1)
In this case, b
is a special kind of matrix called a vector. Presuming that b
is always a column vector, as would be declared in CVX by
variable b(n)
where n is an integer, such as 20 in your case, then the code would be
norm([a;b])
or
norm([a;b],2)
because the default norm in MATLAB and CVX is the 2 norm.
I suggest you spend some time brushing up on the basics of MATLAB, such as concatenation - that will help you a lot in using CVX.