My program shows not enough input arguement....can someone pls explain it to me how to correct it...
조회 수: 1 (최근 30일)
이전 댓글 표시
clear all;
clc;
N=input('enter no of trajectories you want');
for ti=1:N
objval='febAvg';
hold on
for iter = 1:100
Xt_0=0;
t=1;
tmax=1000;
while (t<tmax)
x1=rand(1);
x2=rand(1);
value = feval(objval,x1,x2);
n1=value(1);
n2=value(2);
Q(t)=n1;
Q(t+1)=n2;
delta_t=0.1;
N1=(sqrt(12*pi/delta_t)*n1)/(6*pi)*delta_t;
N2=(sqrt(12*pi/delta_t)*n2)/(6*pi)*delta_t;
Xt_1(t,iter)=Xt_0+N1;
Xt_2(t+1,iter)=Xt_1(t,iter)+N2;
Xt_n(t,iter)=Xt_1(t,iter);
Xt_n(t+1,iter)=Xt_2(t+1,iter);
Xt_0=Xt_2(t+1,iter);
t=t+2;
end
end
for z = 1 : tmax
S=Xt_n.^2;
B(z)=mean(Xt_n(z,:));
A(z)=mean(S(z,:));
sum=0;
for j=1:10
jj=j*10;
for ik=1:jj
sum=sum+S(:,ik);
end
AVG(j).A=sum/ik;
end
timeabs(z)=z*delta_t;
end
plot(0,0,'-');
xlabel('time(t)')
ylabel('x^2')
title('x^2 vs t')
plot(timeabs,A,'g-');
s1=0;s2=0;s3=0;s4=0;s5=0;s6=0;s7=0;s8=0;s9=0;s10=0;
a1=zeros(1,2*N+2);a2=zeros(1,2*N+2);a3=zeros(1,2*N+2);a4=zeros(1,2*N+2);a5=zeros(1,2*N+2);a6=zeros(1,2*N+2);a7=zeros(1,2*N+2);a8=zeros(1,2*N+2);a9=zeros(1,2*N+2);a10=zeros(1,2*N+2);
for i=1:.1*tmax
s1=s1+A;
end
for i=1:.2*tmax
s2=s2+A;
end
for i=1:.3*tmax
s3=s3+A;
end
for i=1:.4*tmax
s4=s4+A;
end
for i=1:.5*tmax
s5=s5+A;
end
for i=1:.6*tmax
s6=s6+A;
end
for i=1:.7*tmax
s7=s7+A;
end
for i=1:.8*tmax
s8=s8+A;
end
for i=1:.9*tmax
s9=s9+A;
end
for i=1:tmax
s10=s10+A;
end
end
a1=s1/N;a2=s2/N;a3=s3/N;a4=s4/N;a5=s5/N;a6=s6/N;a7=s7/N;a8=s8/N;a9=s9/N;a10=s10/N;
Disp(int2str,'a1','a2','a3','a4','a5','a6','a7','a8','a9','a10')
refline(.1061,0)
grid on
댓글 수: 0
채택된 답변
Walter Roberson
2013년 6월 25일
You have the input line
Disp(int2str,'a1','a2','a3','a4','a5','a6','a7','a8','a9','a10')
The first argument there requests that int2str be called with no input arguments and that the result of the int2str be passed as the first argument to Disp(). int2str will complain if it is called with no arguments.
Possibly you want to use 'int2str' or @int2str instead of bare int2str
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!