whats wrong with my code?

조회 수: 1 (최근 30일)
Jasleen Kahlon
Jasleen Kahlon 2020년 3월 20일
댓글: darova 2020년 3월 21일
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
Jasleen Kahlon
Jasleen Kahlon 2020년 3월 20일
if i try to use the function it says it cannot be found
darova
darova 2020년 3월 21일
Filename and function name should be the same

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2020년 3월 20일
He wrote
dx = [0];
and you wrote
dx[0];
  댓글 수: 2
John D'Errico
John D'Errico 2020년 3월 20일
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 2020년 3월 20일
i actually had to do it in parentheses, my professors code was incorrect. But thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by