error ''The function might be unused''

I am trying to call a function 'Fung' but MatLab cannot read. it gives me an error 'The function Fung might be unused'. Any help would be greatly appreciated.
Function mainprogram
...
model='Fung';
iniconstants=[1 0.1 0.1 0.1];
RadLambexp=[riexp lambdaexp];
...
end
function[Pt,Ft]=PF(c,RadLamb,Ro,Ri,theta0,ksi,w,model)
ri=RadLamb(:,1);
lambda=RadLamb(:,2);
P=zeros(length(ri),1);
F=zeros(length(ri),1);
ro=sqrt((Ro.^2-Ri.^2)./pi.*lambda.*theta0+ri.^2);
for i=1:length(ksi)
r=(ro+ri)./2+(ro-ri)./2.*ksi(i);
R=sqrt(Ri.^2+(((pi.*lambda)./theta0).*(r.^2-ri.^2)));
Ezz=0.5*((lambda.^2)-1);
Ett=0.5*(((pi.*r)./(theta0.*R).^2)-1);
calcPartials=str2func(model);
[dWtt,dWzz]=calcPartials(c,Ett,Ezz);
P=P+w(i).*((((pi.*r)./(theta0.*R)).^2).*dWtt)./r;
F=F+w(i).*(2.*lambda.^2.*dWzz-((pi.*r)./(theta0.*R)).^2.*dWtt).*r;
end
Pt=((ro-ri)./2).*P;
Ft=pi.*((ro-ri)./2).*F;
end
function[dWtt,dWzz]=Fung(c,Ett,Ezz)
dWtt=(c(1).*(c(2).*Ett+c(4).*Ezz)).*(exp(c(2).*Ett.^2+c(3).*Ezz.^2+2.*c(4).*Ett.*Ezz));
dWzz=(c(1).*(c(3).*Ezz+c(4).*Ett)).*(exp(c(2).*Ett.^2+c(3).*Ezz.^2+2.*c(4).*Ett.*Ezz));
end

1 comentario

David Young
David Young el 18 de Mzo. de 2014
Where is the call to Fung? I don't think there is one in the code you show, so that's why you get the warning that it appears to be unused.
If there's a call to Fung somewhere in your main program, the problem may be that Fung needs to be in its own m-file, called Fung.m, and not in the same file as PF. Is that the case?

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 18 de Mzo. de 2014
That is a warning, not an error.
What I advise is that you replace
calcPartials=str2func(model);
with
calcPartials = model;
and that in the main function you replace
model='Fung';
with
model = @Fung;

Etiquetas

Preguntada:

el 18 de Mzo. de 2014

Respondida:

el 18 de Mzo. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by