How can I draw a curve based on two parameters?

1 view (last 30 days)
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 Comments
Walter Roberson
Walter Roberson on 1 Sep 2021
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.

Sign in to comment.

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!