Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

what does this mean

Asked by seand munir on 15 May 2013

??? Undefined function or method 'qsFig3_10' for input arguments of type 'double'.

.

when I run or debug my function.

2 Comments

Azzi Abdelmalek on 15 May 2013

how did you get this message?

seand munir on 15 May 2013

i run this function below:

function qsFig3_10
% Fixed test point. The applid force is randomly distributed
% The strength of particles  increases due by repeated stressing due to
% rumooving of weakly particles from collective
M=10;
V=3;
N=10000;                                       %   Number of particles
G=11;                                               %   Number of applied forces used by every test
   BFN=M+V*randn(1,N);  %   Breakage force (particel strength) 
  distribution 
Mln = log(M^2 / sqrt(V^2+M^2))
Vln = sqrt(log(V^2/M^2 + 1))
BFL=lognrnd(Mln,Vln,1,N);
% BFw=1.185*wblrnd(10,4,1,N);
% BFr=M/2+V*rand(1,N)/0.289;
% BFe=4*wblrnd(2.5,1,1,N);
% mBFe=mean(BFe)
% SBFe=std(BFe)
% mBFr=mean(BFr);
% SBFr=std(BFr);
% % mBFL=mean(BFL);
% % SBFL=std(BFL);
% mBFw=mean(BFw);
% SBFw=std(BFw);
% [Fw Xw]=ecdf(BFw);
 [FL XL]=ecdf(BFL);
[Fn Xn]=ecdf(BFN);
% [Fr Xr]=ecdf(BFr);
% % [Fe Xe]=ecdf(BFe);
figure(5);
plot(Xn,Fn,'k',XL,FL,'LineWidth',3);
% plot(Xn,Fn,'k',Xw,Fw,'k:',Xr,Fr,'k--','LineWidth',3);
xlabel('Breakage force', 'FontSize', 16);
ylabel('Cumulative probability','FontSize', 16);
legend('normal','lognormal');
BF=BFN;
ST=[mean(BF)];
   L=length(BF);
%  for  n1=1:5;
   [M,FnB]=dNumber(N,BF,G);
   length(M)
P=disNumb(M,G,L);
SP=[1 1 0.4];
   yf=expfitP(P,SP);
   L=length(FnB);
   N=length(FnB);
   ST=[ST,mean(FnB)];
   BF=FnB; 
   h=1:length(P);
   NN=length(P);
   X = fminsearch(@(x,p) qfit(x,P),[0.8]);
   X
   Pq=qyfit(X,P(1),NN);
   figure(1)
   plot(h,P,'ko',h,Pq,'k--','LineWidth',2);
   legend('M-C data')
   xlabel('Breakage number','FontSize', 16);
   ylabel('Breakage probability','FontSize', 16);
  % title('Breakage number distribution');
  grid('on');
  hold on;
  %  end;
%  n2=1:length(ST);
%  SP=[mean(BF) 1 0.4];
%  sf=expfitP(ST,SP);
%  figure(2)
%  plot(n2,ST,'o',n2,sf);
      function [M,FnB]=dNumber(N,BF,G);
   M=[]; FnB=[]; d=0.2;
   for n=1:N;
      AF=10+3*randn(1,G);
      MH=max(AF);m=1;
      while BF(n)>=AF(m)& m<=length(AF)-1;
           %BF(n)=BF(n)*(1-d*AF(m)/mean(AF)); %  Damage accomulation
          m=m+1;
      end; 
     c=1;
      if m==G; 
          FnB=[FnB,BF(n)];
          m=[];
   end;
   M=[M,m];
   end;
      function P=disNumb(R,G,TN);
          p=[];
          for k=1:G-1;
              p=[p,sum(R==k)];
          end;
          p=p/TN;
          P(1)=p(1);
           for k=2:G-1;
               P(k)=P(k-1)+p(k);
           end;
    function [Yfit]=expfitP(P,SP);
   x=1:length(P);
     y=P;
      h=fittype('a*(1-b*exp(-c*x))');
  [Y Par]=fit(x',y',h,'StartPoint',SP);
  Y
  Par
  Yfit=Y(x);
function y=qfit(x,p);
N=length(p);
w=p(1);
Pfit(1)=w;
Nb(1)=1-w;
for k=2:N;
   Nb(k)=Nb(k-1)*(1-w*x(1)^(k)); 
Pfit(k)=1-Nb(k);
end;
y=sum((p-Pfit).^2);
      function P=qyfit(q,w,n);
        v(1)=1-w; P(1)=w;
        for j=2:n;
            v(j)=v(j-1)*(1-w*q^(j));
            P(j)=1-v(j);
        end;
seand munir

Tags

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 15 May 2013
Accepted answer

You do not have the file qsFig3_10.m in your MATLAB path. Possibly you have defined a function with a very similar name but have made a typing mistake when you called it.

2 Comments

seand munir on 15 May 2013

let me change the name of the function and file together.

seand munir on 15 May 2013

it is run succesfully. thanks.

Walter Roberson

Contact us