Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Absolute value and length of a complex vector

Subject: Absolute value and length of a complex vector

From: Greg Heath

Date: 20 Aug, 2013 14:20:27

Message: 1 of 3

Calculate, by hand, the absolute value and length of the following complex vector

A = [ 1 + 2i, 3 + 4i ]

Now, compare your answers with the abs and length functions

absA = abs(A)

lengthA = length(A)

How did you do?

Greg

Subject: Absolute value and length of a complex vector

From: Josh Meyer

Date: 20 Aug, 2013 15:45:09

Message: 2 of 3

"Greg Heath" <heath@alumni.brown.edu> wrote in message
news:kuvtvb$gve$1@newscl01ah.mathworks.com...
> Calculate, by hand, the absolute value and length of the following complex
> vector
>
> A = [ 1 + 2i, 3 + 4i ]
>
> Now, compare your answers with the abs and length functions
>
> absA = abs(A)
>
> lengthA = length(A)
>
> How did you do?
>
> Greg

length(A) has to do with number of dimensional elements, not the actual
length of the vector in the complex or
real planes. The function you're probably looking for here is norm(A).
 

Subject: Absolute value and length of a complex vector

From: Steven_Lord

Date: 20 Aug, 2013 16:55:50

Message: 3 of 3



"Josh Meyer" <jmeyer@mathworks.com> wrote in message
news:kv02u7$fed$1@newscl01ah.mathworks.com...
> "Greg Heath" <heath@alumni.brown.edu> wrote in message
> news:kuvtvb$gve$1@newscl01ah.mathworks.com...
>> Calculate, by hand, the absolute value and length of the following
>> complex vector
>>
>> A = [ 1 + 2i, 3 + 4i ]
>>
>> Now, compare your answers with the abs and length functions
>>
>> absA = abs(A)
>>
>> lengthA = length(A)
>>
>> How did you do?
>>
>> Greg
>
> length(A) has to do with number of dimensional elements, not the actual
> length of the vector in the complex or
> real planes. The function you're probably looking for here is norm(A).

Adding to what Josh said, ABS is an elementwise function. Its output is the
same size as its input, and each element of the output is the absolute value
or complex modulus of the corresponding element of the input. Like with
LENGTH, what I suspect you expected absA to be is actually norm(A) or (since
this is in 2-D) hypot(A(1), A(2)).

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us