フィルターのクリア

Plotting for specific values

3 ビュー (過去 30 日間)
Purnjay Peshawaria
Purnjay Peshawaria 2020 年 11 月 18 日
コメント済み: Purnjay Peshawaria 2020 年 11 月 18 日
I have a matrix U of size (P + 1)*(N+1) , 2 row vectors node and t of lengh P + 1 and N+1 respectively.
These row vectors are defined as follows :
node = linspace(0, 1 ,P+1)
t = linspace(0, T, N+1)
Take T to be 2.5 and choose P and N arbitrarily.
plot(node,U(:,161), node, U(:, 321), node,U(:,481), node, U(:,641),node,U(:,801));
Here 161 is when t = 0.25, 321 is when t = 0.5, 481 is when t = 0.75, 641 is when t = 1.0 and so on.
How can I accomplish this task without hard coding ? I want to plot U(: , t) against node for specific values of t = 0.25,0.5,0.75 and so on.
Any help appreciated.

採用された回答

Jon
Jon 2020 年 11 月 18 日
plot(node,U(:,t==0.25),node,U(t==0.5)) % and so on
  2 件のコメント
Jon
Jon 2020 年 11 月 18 日
You could further genaralize this as
tPlot = 0.25:0.25:tPlotMax % for some defined value of tPlot
plot(node,U(:,t==tPlot(1)),node,U(t==tPlot(2))) % and so on
You just have to be careful that the values in tPlot are an exact match for values in t
Purnjay Peshawaria
Purnjay Peshawaria 2020 年 11 月 18 日
Thanks!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInstall Products についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by