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;
c=.0054;
dx(1) = (a*c)+(b*c);
and the code i used was:
can someone please tell me whats wrong with it???

3 个评论

Why do you think there is something wrong with it?
if i try to use the function it says it cannot be found
Filename and function name should be the same

请先登录,再进行评论。

 采纳的回答

He wrote
dx = [0];
and you wrote
dx[0];

2 个评论

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

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by