필터 지우기
필터 지우기

Input argument "alpha" is undefined.

조회 수: 3 (최근 30일)
naeem
naeem 2014년 11월 27일
댓글: Torsten 2014년 12월 1일
i get this error. how to solve this error?????
""""??? Input argument "alpha" is undefined.
Error in ==> newvod3RL at 6 alphaINT = (real(alpha)>0) .* ceil(real(alpha)) + ... """
function out = vod3RL(t, in, alpha)
% function out = vod3RL(t, in, alpha)
% Variable order derivative, Riemann-Liouville definition, variant 3.
% Duarte Valrio, 2009.
alphaINT = (real(alpha)>0) .* ceil(real(alpha)) + ...
( (real(alpha)==0) & (imag(alpha)~=0) ); % number of differentiations to perform
alphaRES = alpha - alphaINT; % residue of alphaINT with negative real part only
% negative differentiation (i.e. integration) performed
out = zeros(size(t));
for k = 2 : length(t) % the first integral is always 0, since no time elapsed, hence no need to make k = 1...
tau = t(1:k);
integrand = (t(k) - tau).^(-alphaRES(k - (1:k) + 1) - 1) ./ gamma(-alphaRES(k - (1:k) + 1)) .* in(1:k);
if any(~isfinite(integrand)) % eliminate eventual inf and nan points
integrand(find(isinf(integrand))) = 0;
integrand(find(isnan(integrand))) = 0;
end
integrand(1) = 2*integrand(1); % this is to handle steps properly with Caputo's definition
% (otherwise the first point only has half the influence and the result comes halved all the way to the end)
out(k) = sum( (integrand(1:end-1)+integrand(2:end))/2 .* (tau(2:end)-tau(1:end-1)) );
end
% necessary differentiations performed
while 1
if sum(alphaINT) == 0, break, end % exit condition
temp = diff([0; out]) ./ [t(2)-t(1); diff(t)]; % this is to handle steps properly
out = out.*(alphaINT==0) + temp.*(alphaINT~=0);
alphaINT = (alphaINT-1) .* (alphaINT~=0); % take away one integration
end
alphaINT = (real(alpha)>0) .* ceil(real(alpha)) + ...
  댓글 수: 1
Torsten
Torsten 2014년 11월 27일
The error addresses a function called "newvod3RL", but you posted "vod3RL".
I suspect that a variable "alpha" does not appear in the list of parameters for function "newvod3RL".
Best wishes
Torsten.

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

답변 (1개)

Stalin Samuel
Stalin Samuel 2014년 11월 27일
편집: Stalin Samuel 2014년 11월 27일
before using a variable alpha in function you must use that variable alpha.It may be initialization or some other value
  댓글 수: 2
naeem
naeem 2014년 11월 30일
i am supplying three inputs as
alpha=0.9 in=0.5 t=1 and now i am getting an error of
??? Attempted to access t(2); index out of bounds because numel(t)=1.
Error in ==> vod1RL at 30
temp = diff([0; out]) ./ [t(2)-t(1); diff(t)]; % this is to handle steps properly
Torsten
Torsten 2014년 12월 1일
But you write yourself that you supply t=1 to vod3RL.
This is a scalar value - consequently t(2) (which you address to in the above expression) does not exist.
Best wishes
Torsten.

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

Community Treasure Hunt

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

Start Hunting!

Translated by