How to plot multiple data sets on the same graph

1,068 ビュー (過去 30 日間)
usman younus
usman younus 2017 年 9 月 20 日
コメント済み: Nick Hyde 2022 年 2 月 28 日
E_total_Ps =[2146.42,2146.85, 2147.28, 2147.71,2148.14,2148.58,2149.01,2149.44,2149.87,2150.30,2150.74];
E_total_Ptx =[2145.98, 2248.57, 2351.15, 2453.74, 2556.33, 2658.91,2761.50, 2864.08, 2966.67, 3069.25,3171.84];
i=0.01:0.001:0.02;
plot(i,E_total_Ps,'b--*',i,E_total_Ptx,'r--o')
legend('Ps','Ptx')
xlabel('Sampling/Tx Power (W)')
ylabel('EC(j)')
E_total_Fs =[ 2145, 2149 , 2153, 2157 , 2161];
E_total_Ftx =[ 2145, 4283, 6421, 8559, 10697];
i=1:1:5;
plot(i,E_total_Fs,'b--<',i,E_total_Ftx,'r-->')
legend('Fs','Ftx')
xlabel('Sampling/Tx frequency')
ylabel('EC(j)')

採用された回答

Brendan Hamm
Brendan Hamm 2017 年 9 月 20 日
Use hold on and hold off to add new data to a set of existing Axes.
plot(x1,y1)
hold on
plot(x2,y2)
hold off
Annotate:
legend(..)
xlabel(...)
ylabel(...)
  2 件のコメント
Michael Miller
Michael Miller 2020 年 4 月 13 日
How do you fit a line to the 2 two points?
Nick Hyde
Nick Hyde 2022 年 2 月 28 日
thank you, makes it so easy

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by