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

조회 수: 6 (최근 30일)
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.

채택된 답변

Juan Carlos Ponce Campuzano
Juan Carlos Ponce Campuzano 2021년 3월 13일
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
Steven Lord
Steven Lord 2021년 3월 13일
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
Juan Carlos Ponce Campuzano
Juan Carlos Ponce Campuzano 2021년 3월 13일
Thank you so much. That makes it clearer. :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by