How can I plot a plot with two parameters?

4 views (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!

Accepted Answer

dpb
dpb on 26 Aug 2021
It would be far easier if you would attach a short(ish) section of your data files themselves instead of us having to try to interpret..what are the ni variables above, for example?
But, the answer to the last question is simply
>> dt=4E-14;
>> N=3E-9/dt
N =
75000
>>
so it takes 75,000 elements at that sample rate to amount to 3 nsec...
  6 Comments
mohammad heydari
mohammad heydari on 29 Aug 2021
Please ignore the previous message and return to the previous two messages. This piece, which I have given in the figure below, has been completely analyzed. I do not want to bother you with physical concepts. I came up with the correct results given the very complex equations solved. Any parameter that I draw in terms of t, which is time, is the correct result. Now I want to draw each parameter in terms of x, which is the position of a piece, and at a given time t = t0. In the figure below, I have explained these concepts quite simply.
Unfortunately I could not upload workspacet here due to the large size of the workspace, otherwise we might have been able to talk about it easily. Anyway, I have listed them in the attached file above. The relationship between pout, t, x is completely solved without any problems. And the output obtained with the following command is completely correct.
plot(t,pout);
Now drawing the same pout in terms of x and at time t = t0 has caused me problems due to the inequality of the dimensions of pout and x as the first problem and determining a specific time point as the second problem. The desired shape is shown in the attached file as output obtained in the past. I have fully shown the basic values ​​and parameters in the previous two messages. If you still have questions, I will try to answer quickly. Thank you very much.
dpb
dpb on 29 Aug 2021
" I could not upload workspacet here due to the large size of the workspace, otherwise we might have been able to talk about it easily. "
Indeed. Surely you can create a subset of the dataset that is sufficient to illustrate the difficulties but that somebody here can actually touch.
Without that, it's going to take somebody a lot more able to figure out what you're asking for than I to be able to help, I'm afraid.

Sign in to comment.

More Answers (0)

Categories

Find more on Line 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!