Input argument "alpha" is undefined.

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 Commento

Torsten
Torsten il 27 Nov 2014
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.

Accedi per commentare.

Risposte (1)

Stalin Samuel
Stalin Samuel il 27 Nov 2014
Modificato: Stalin Samuel il 27 Nov 2014

0 voti

before using a variable alpha in function you must use that variable alpha.It may be initialization or some other value

2 Commenti

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
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.

Accedi per commentare.

Categorie

Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange

Richiesto:

il 27 Nov 2014

Commentato:

il 1 Dic 2014

Community Treasure Hunt

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

Start Hunting!

Translated by