How to make the x and y vector the same length

조회 수: 16 (최근 30일)
Junyao Zhang
Junyao Zhang 2020년 11월 22일
댓글: Junyao Zhang 2020년 11월 22일
subplot(7,3,[7 16]+2); hold on;
sess5.LRx=linspace(-135,135);
plot(sess5.LRx,sess5.time,'b');
This is the code I have, The sess5.time got more than 10,000 elements, how can I make it work?

채택된 답변

Cris LaPierre
Cris LaPierre 2020년 11월 22일
편집: Cris LaPierre 2020년 11월 22일
Take a look at the documentation for linspace.
If you only input the start and stop values, linspace creates a vector with 100 values. You can include a third input to specify the number of values to create. You can use the length command to determine the maximum dimesion of a variable. Use this to automatically determine the number of values to create.
sess5.LRx=linspace(-135,135,length(sess5.time));
  댓글 수: 1
Junyao Zhang
Junyao Zhang 2020년 11월 22일
So I need to add a n here to make it equal...Thank you

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by