Formula for norm(x)
Show older comments
Hi everyone, please describe me the formula for norm (x) where x is a complex vector?
1 Comment
James Tursa
on 22 Sep 2022
Accepted Answer
More Answers (1)
Assuming you're only interested in p=2, if you already have code that computes norm(x) for real x, you can extend it to complex x via,
norm(x) = norm( [norm(real(x)), norm(imag(x)) ] )
which is easily verified below,
x=complex(rand(5,1), rand(5,1));
norm(x)
norm( [norm(real(x)), norm(imag(x)) ] )
Alternatively, if you have an implementation of abs, you could do norm(abs(x),p) which will work for any p-norm
p=3;
norm(x,p)
norm(abs(x),p)
Categories
Find more on Loops and Conditional Statements 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!