I want show ylabel like 36m, 38m, 40m on plot I have variable population, plz help
조회 수: 1 (최근 30일)
이전 댓글 표시
% Define parameters
PopSaudi22
P_0 = PopSaudi22.POPTOTL % Initial population (1 million)
r = 0.02; % Annual growth rate (2%)
t = 1:1:20; % Time in years from 0 to 50 with a step of 0.1
% Compute population over time
P = P_0 * exp(r * t)
% Plot the result
figure;
plot(t, P,'-o', 'LineWidth', 2);
xlabel('Time (years)');
ylabel('Population in million');
title('Exponential Population Growth');
grid on;
I use an equation this: P = P_0 * exp(r * t)
댓글 수: 0
채택된 답변
Voss
2024년 6월 18일
P_0 = 1e6; % Initial population (1 million)
r = 0.02; % Annual growth rate (2%)
t = 0:0.1:50; % Time in years from 0 to 50 with a step of 0.1
% Compute population over time
P = P_0 * exp(r * t)
% Plot the result
figure;
plot(t, P/1e6,'-o', 'LineWidth', 2);
xlabel('Time (years)');
ylabel('Population in million');
title('Exponential Population Growth');
grid on;
ax = gca();
yt = get(ax,'YTick');
ax.YTickMode = 'manual';
ax.YTickLabel = yt+"m";
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!