Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
need help fixing errors..
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
in the command window i typed: tradeoffp(0.5,0.6)
received error statement: Undefined function 'tradeoffp' for input arguments of type 'double'.
Code below:
function [Survival]=tradeoffp(X,Y)
% function [Survival]=tradeoff(X,Y)
% 'X' should be a vector with varying numbers for different predator levels
% - one for the low end of the range considered, the other the high end
% There are one output.
% Survival - the males' survival
% X is alpha value a is between 0 and 1.
R=linspace(0,10,100);
% the above lets us consider 100 different males,
% resources varying between the lowest 0 and highest
% 10 value given as inputs
for i=1:length(R)
for j=1:101
% this is the survival equation considering resources and predators
Survival(X,Y,'uint8')=(X.*R(i))+((1-X).*R(i)).*(P(j)/(1+P(j)))-(Y.*P(j));
end
end;
figure(1);
plot3(R,P,Survival,'g');
grid on
title('tradeoffp')
xlabel('Resources')
ylabel('Predators')
zlabel('Survival');
0 comentarios
Respuestas (1)
Lisa Wu
el 8 de Mayo de 2013
What's the P(j)? Before using the varible P ,you need to initialize it, such as P = linspace(0,1,101); And feel confused about this line : (X,Y,'uint8')=(X.*R(i))+((1-X).*R(i)).*(P(j)/(1+P(j)))-(Y.*P(j));
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!