What is the meaning of the symbol (') at the end of linspace?

6 views (last 30 days)
Hello everyone,
I just started learning MATLAB. I was reading the documentation to plot discrete sequences: https://au.mathworks.com/help/matlab/ref/stem.html
I tried these lines of code online:
figure
X = linspace(0,2*pi,50)';
Y = [cos(X), 0.5*sin(X)];
stem(X,Y)
What is the meaning of the symbol (') in the linspace command before (;)? I can't find documentation about it. I noticed that if I remove it I get the error: X must be same length as Y.
Any help will be appreciate it. Thanks.

Accepted Answer

Juan Carlos Ponce Campuzano
I just figured it out.
This is a row vector:
linspace(0, 2*pi, 50);
This is a colum vector:
linspace(0, 2*pi, 50)';
:)
  2 Comments
Steven Lord
Steven Lord on 13 Mar 2021
That is correct. It is the conjugate transpose operator. If your data may be complex you should use the transpose operator .' if you don't want to take the conjugate.
x = (1:5)+(6:10)*1i % positive imaginary parts
x =
1.0000 + 6.0000i 2.0000 + 7.0000i 3.0000 + 8.0000i 4.0000 + 9.0000i 5.0000 +10.0000i
yConjugate = x' % negative imaginary parts
yConjugate =
1.0000 - 6.0000i 2.0000 - 7.0000i 3.0000 - 8.0000i 4.0000 - 9.0000i 5.0000 -10.0000i
yNonconjugate = x.' % positive imaginary parts
yNonconjugate =
1.0000 + 6.0000i 2.0000 + 7.0000i 3.0000 + 8.0000i 4.0000 + 9.0000i 5.0000 +10.0000i

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!