I want to use the L0 norm ?

26 views (last 30 days)
Nora Khaled
Nora Khaled on 30 Apr 2019
Answered: Bruno Luong on 6 Oct 2020
Hi !
I was trying to use the function norm(v,p). but p takes value from 1 to inf.
How can I calulate the zero norm ?

Accepted Answer

Nora Khaled
Nora Khaled on 1 May 2019
I used sum(x>0).
  1 Comment
LANTIAN WEI
LANTIAN WEI on 6 Oct 2020
Edited: LANTIAN WEI on 6 Oct 2020
sum(abs(x)>0) will be better

Sign in to comment.

More Answers (1)

Bruno Luong
Bruno Luong on 6 Oct 2020
nnz(x)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!