How can I draw a curve based on two parameters?

조회 수: 3 (최근 30일)
mohammad heydari
mohammad heydari 2021년 8월 26일
댓글: mohammad heydari 2021년 9월 1일
Hi,
I want to plot a "ngs(n1+n2+n3+2,:)" that is a "224*67501" matrix, versus longitudinal position(millimeter) "X" which is a "224*1" matrix, At desired time between 0 and 3 nanoseconds. Also "t" is a matrix with 1*67501 and dt=4.4e-14(step time). I try it but I encounter two pronlems. Firstly, "vectors must be the same lenghs" when I want to plot:
plot(X,ngs(n1+n2+n3+2,:))
secondly, I do not know how to draw it at a specific time between 0 and 3 nanoseconds.
Thanks in advance for your guidance!
  댓글 수: 4
Walter Roberson
Walter Roberson 2021년 9월 1일
You said that X is 224*1 .
size(n3,2) is the number of columns in n3.
repmat(X,1,size(n3,2)) requests to replicate X (224 x 1), with the repeating to be 1 time in the first dimension (leaving it 224 x something), and size(n3,2) times in the second dimension. X is currently x 1 in the second dimension.
The effect is to take the column vector X and to repeat that column vector 67501 times, so that you get a 224 x 67501 array in which every column is the same as every other column.
mohammad heydari
mohammad heydari 2021년 9월 1일
I fully understood it.
thank you very much.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by