How can I plot a plot with two parameters?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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!
採用された回答
dpb
2021 年 8 月 26 日
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 件のコメント
mohammad heydari
2021 年 8 月 26 日
Thank you,
I wanted to upload the program but it will not be useful because it takes more than half a day to simulate. I also wanted to upload Workspace, but I was limited. I entered the basic parameters in the code, part of code and attached the photo file from Workspace and desired figure. I still have not found the answer to my question, how is it possible to draw "ngs" in terms of "x" at a given time?
Thank you very much for your help.
n1=100;
n2=22;
n3=100;
tmax=3*10^-9;
dx=zeros(n1+n2+n3+1,1);
for n=1:n1
dx(n,1)=0.5*(l-lsa)/(n1+0.5);
end
for n=n1+2:n1+n2+1
dx(n,1)=lsa/(n2+0.5);
end
for n=n1+n2+2:n1+n2+n3+1
dx(n,1)=0.5*(l-lsa)/(n3+0.5);
end
x(1,1)=0;
for n=1:n1+n2+n3+1
x(n+1,1)=x(n,1)+dx(n,1);
end
dx(n1+1,1)=(dx(n1,1)+dx(n1+2,1))/2;
dx(n1+n2+1,1)=(dx(n1+n2,1)+dx(n1+n2+2,1))/2;
dt=min(dx(n1+n2+2,1),min(dx(1,1),dx(n1+2,1)))/(1.25*vg);
nt=floor(tmax/dt)+1
ngs=zeros(n1+n2+n3+2,nt);
t=0:dt:tmax
dpb
2021 年 8 月 26 日
n1=100;
n2=22;
n3=100;
tmax=3*10^-9;
dx=zeros(n1+n2+n3+1,1);
dx(1:n1,1)=0.5*(l-lsa)/(n1+0.5);
dx(n1+2:n1+n2+1,1)=lsa/(n2+0.5);
dx(n1+n2+2:n1+n2+n3+1,1)=0.5*(l-lsa)/(n3+0.5);
x=[0;cumsum(dx)];
dx(n1+1)=(dx(n1)+dx(n1+2))/2;
dx(n1+n2+1,1)=(dx(n1+n2,1)+dx(n1+n2+2,1))/2;
dt=min(dx(n1+n2+2,1),min(dx(1,1),dx(n1+2,1)))/(1.25*vg);
nt=floor(tmax/dt)+1
ngs=zeros(n1+n2+n3+2,nt);
t=0:dt:tmax
mohammad heydari
2021 年 8 月 29 日
編集済み: mohammad heydari
2021 年 8 月 29 日
Thanks for the information, but I've been having this problem for a few days now. Let me ask very simply.I have a matrix N whose dimensions are 3*15. And I want to plot it in terms of the matrix P, which is a 7*1 matrix, and for just one number of the t-matrix, which is 1*15. What should this custom look like?
N=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15;16 17 18 19 20 21 22 23 24 25 26 27 28 29 30; 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45]
p=[60 70 80 90 100 110 120]'
t=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 ]
Now, how can i plot it?
dpb
2021 年 8 月 29 日
I still can't follow what you think you want plotted, sorry...what relationship does p have to anything in N and t and what do you expect a plot of just one point out of t to be other than a single point?
Furthermore, the size of p is not commensurate with any of the dimensions of either t or N so what's going to match up with what?
If you can visualize what you think this plot would be, attach a sketch showing how you would draw it by hand, labelling where the various pieces of the above arrays go to produce the figure.
mohammad heydari
2021 年 8 月 29 日
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
2021 年 8 月 29 日
" 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.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Annotations についてさらに検索
タグ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
