i am trying to execute these commands but i am getting this error "Not enough input arguments."

조회 수: 1 (최근 30일)
i am executing the switch statement with the function.
function f=func(x,fun_num)
[ps,d]=size(x);
%fun_num=1 Parameter Estimation for Frequency-Modulated (FM) Sound Waves,initialization range=[0,6.35], bound=[-6.4,6.35] , length of x=6.
switch fun_num
case 1
if d<6
disp('dimension-size should be six.')
else
if d>6
disp('dimension-size is more than 6.')
disp('function has been evaluated on first six dimensions.')
end
end
theta=2*pi/100;
f=0;
for t=0:100
y_t=x(1)*sin(x(2)*t*theta+x(3)*sin(x(4)*t*theta+x(5)*sin(x(6)*t*theta)));
y_0_t=1*sin(5*t*theta-1.5*sin(4.8*t*theta+2*sin(4.9*t*theta)));
f=f+(y_t-y_0_t)^2;
end

답변 (1개)

Star Strider
Star Strider 2015년 8월 21일
How are you calling the ‘func’ function?
What line of what script or function is throwing the error? Copy and paste the entire red text from the Command Window to your original Question or a Comment to it.
  댓글 수: 2
Muhammad Umer
Muhammad Umer 2015년 8월 21일
calling of function func
Fitness(i)=func(Sol(i,:));
error
Error using bat func line(switch fun_num)
Not enough input arguments.
Error in bat line()
Fitness(i)=func(Sol(i,:));
Star Strider
Star Strider 2015년 8월 21일
Your ‘func’ function requires two arguments:
func(x,fun_num)
You have to figure out what to give it for each argument.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by