MATLAB Answers

whats wrong with my code?

1 view (last 30 days)
Jasleen Kahlon
Jasleen Kahlon on 20 Mar 2020
Commented: darova on 21 Mar 2020
i was trying to make a funtion for school and my teacher gave me a code that he used to make the funtion.
the code he used was:
function dx = colour_selection_2020f (t,x)
dx = [0];
% 'a' is the selection strength for colouration based on female preference
% 'b' is the selection strength based on predation pressure
% 'c' is the narrow sense haritability of colouration
a = .68;
b= -.71;
dx(1) = (a*c)+(b*c);
and the code i used was:
can someone please tell me whats wrong with it???


darova on 20 Mar 2020
Why do you think there is something wrong with it?
Jasleen Kahlon
Jasleen Kahlon on 20 Mar 2020
if i try to use the function it says it cannot be found
darova on 21 Mar 2020
Filename and function name should be the same

Sign in to comment.

Accepted Answer

the cyclist
the cyclist on 20 Mar 2020
He wrote
dx = [0];
and you wrote


John D'Errico
John D'Errico on 20 Mar 2020
Well, since the only difference was the presence of an = operator, the two versions should be "equal", right? I just break me up.
Jasleen Kahlon
Jasleen Kahlon on 20 Mar 2020
i actually had to do it in parentheses, my professors code was incorrect. But thank you!

Sign in to comment.

More Answers (0)

Sign in to answer this question.


No tags entered yet.

Translated by