line graphed at bottom of the figure
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I am having this problem once again, with my graphed data being stuck to the bottom of the image. In the past is has been resiolved using '.' before * and a ':' instead of a common... however I have gone through the code and cannot find the problem, does anyone else see it? Thanks!

% Beverton-Holt Model
% Parameter and intial condtions
Labels2 = [1790:10:1860]';
Labels = [1790:10:2010]';
Pe= 330.0
a1= 1.23065
b2= 2110.5
p3= [2.913 3.929 5.308 7.239 9.638 12.866 17.069 23.191 39.818 50.189 62.947 76.212 92.228 106.021 122.775 132.164 150.697 179.323 203.302 226.545 248.709 281.421 308.745]';
Data = p3;
% Fix b(a-1) = 330.0
C = (Data(1:22,1)./Data(2:23,1))-1;
D = Data(1:22,1).*(1-(330.0./Data(2:23,1)));
Y = C\D;
b6 = Y(1,1);
a6 = 1 + 330.0./b;
P0 = Data(1,1);
FF = zeros(23,1);
FF(1,1) = P0;
% Bevholt equation
for i= 2:23
EE(i,1) = (a1.*p3(i-1,1))./(1+(p3(i-1,1)./b2));
end
% Time interval
t = (1790:10:2010)';
% Time Interval
a1=(1790:10:2010)';
% Population
b2= [3.929 5.308 7.239 9.638 12.866 17.069 23.191 31.443 39.818 50.189 62.947 76.212 92.228 106.021 122.775 132.164 150.697 179.323 203.302 226.545 248.709 281.421 308.745]';
% Plot
plot(Labels,Data,'b-*',Labels,FF,'r-*');
title('Beverton-Holt Model, 1790-2010')
legend('Beverton-Holt Model','Census Data')
axis([1790 2010 0 500]);
ylabel('Population (Millions)');
xlabel ('Years');
hold on
%R2
SST = sum((Data-mean(Data)).^2);
SSE = sum((Data-FF).^2);
R2 = 1- (SSE/SST)
0 commentaires
Réponses (1)
Mario Malic
le 17 Nov 2020
Modifié(e) : Mario Malic
le 22 Nov 2020
Hello,
Only the first element of FF, is not 0 which explains how the plot looks.
FF = zeros(23,1);
FF(1,1) = P0;
0 commentaires
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!