I want to setting my X-axis plot
Show older comments
My plot is starting from 0. I want to start the plot from axis (x,y),(1;0.5)
this is my function
function gsst_3
% 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=1000; % 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',Xw,Fw,'k:',Xr,Fr,'k--','LineWidth',3);
% xlabel('Breakage force', 'FontSize', 16);
% ylabel('Cumulative probability','FontSize', 16);
% legend('normal','wbl','random');
BF=BFN;
ST=[mean(BF)];
L=length(BF);
% for n1=1:15;
[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;
% ST(1)=[];
% 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=zeros(G,1);
d=0.2;
for n=1:N;
AF=10+3*randn(1,G);
BF=10+3*randn(1,G);
r=unidrnd(G-1,G,1);
m=1; m1=1;
while BF(m1)>=AF(m)& m<=G-1;
m=m+1;
m1=r(m);
%BF(m1)=BF(m1)*(1-d*AF(m)/mean(AF)); % To tacke into account the
% %damage accomulation uncoment row 86
end;
c=1;
if m==G;
FnB=[FnB,BF'];
m=[];
end;
M=[M,m];
size(FnB)
length(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;
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!