How can I resolve an invalid date argument using plot?

7 ビュー (過去 30 日間)
Brooke Gest
Brooke Gest 2019 年 2 月 28 日
コメント済み: Brooke Gest 2019 年 2 月 28 日
x = (1804:2300);
y = 10./(1+(9.*exp(-0.01*x)));
plot (x,y, 'b', '-');
x = [1804 1927 1960 1974 1987 1999 2011];
y = [1 2 3 4 5 6 7];
plot (x,y, 'r', 's');
title ('Population Over Time');
xlabel = 'Year';
ylabel = 'Population (in billions)';
legend ('Population model' , 'Measured Population');
hold on;

採用された回答

madhan ravi
madhan ravi 2019 年 2 月 28 日
x = 1804:2300;
y = 10./(1+(9.*exp(-0.01*x)));
yyaxis left
plot(x,y, 'b-');
xx = [1804 1927 1960 1974 1987 1999 2011];
yy = [1 2 3 4 5 6 7];
yyaxis right
plot (xx,yy,'rs')
title ('Population Over Time')
xlabel('Year')
ylabel('Population (in billions)')
legend('Population model' , 'Measured Population')
  1 件のコメント
Brooke Gest
Brooke Gest 2019 年 2 月 28 日
Thank you!!!! I'm pretty new at this and it was taking me forever to figure out what was wrong!!

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

その他の回答 (1 件)

KSSV
KSSV 2019 年 2 月 28 日
Read about plot
x = (1804:2300);
y = 10./(1+(9.*exp(-0.01*x)));
plot (x,y, 'b', '-');
hold on
x = [1804 1927 1960 1974 1987 1999 2011];
y = [1 2 3 4 5 6 7];
plot (x,y, 'r', 's');
title ('Population Over Time');
xlabel = 'Year';
ylabel = 'Population (in billions)';
legend ('Population model' , 'Measured Population');
hold on;

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by