code for plot figure

17 views (last 30 days)
Mariam Gasra
Mariam Gasra on 15 Apr 2019
Commented: Mariam Gasra on 15 Apr 2019
lamda=0.2;
mu=1-lamda;
P1=mu^2/(mu+lamda)^2;
P2=2*lamda*mu/(mu+lamda)^2;
P3=lamda^2/(mu+lamda)^2;
display(P1);
display(P2);
display(P3);
for t=1:5:100
P11(t)=((mu+lamda)^2)-( 2*lamda)*((mu-lamda)*exp(-(mu-lamda)*t)-mu+(lamda*exp(-2*(mu+lamda)*t)))-(lamda^2)*(2*exp(-mu*t)-2*exp(-(mu+lamda)*t)+1-exp(-2*(mu+lamda)*t));
P22(t)=((-2*lamda)*(mu-lamda)*exp(-(mu+lamda)*t)/(lamda+mu)^2)+(2*lamda*mu/(lamda+mu)^2)-2*(lamda)^2*exp(-2*(mu+lamda)*t);
P33(t)=(lamda^2)/(lamda+mu)*((2*exp(-2*mu*t))-(2*exp(-(mu+lamda)*t))-exp(-2*(mu+lamda)*t)+1);
end
A=P11;
B=P33;
C=P22;
display(A);
display(B);
display(C);
i want tp Plot A,B,C with respect to t

Accepted Answer

KSSV
KSSV on 15 Apr 2019
lamda=0.2;
mu=1-lamda;
P1=mu^2/(mu+lamda)^2;
P2=2*lamda*mu/(mu+lamda)^2;
P3=lamda^2/(mu+lamda)^2;
display(P1);
display(P2);
display(P3);
t = 1:5:100 ;
P11 = zeros(size(t)) ;
P22 = zeros(size(t)) ;
P33 = zeros(size(t)) ;
for i = 1:length(t)
P11(i)=((mu+lamda)^2)-( 2*lamda)*((mu-lamda)*exp(-(mu-lamda)*t(i))-mu+(lamda*exp(-2*(mu+lamda)*t(i))))-(lamda^2)*(2*exp(-mu*t(i))-2*exp(-(mu+lamda)*t(i))+1-exp(-2*(mu+lamda)*t(i)));
P22(i)=((-2*lamda)*(mu-lamda)*exp(-(mu+lamda)*t(i))/(lamda+mu)^2)+(2*lamda*mu/(lamda+mu)^2)-2*(lamda)^2*exp(-2*(mu+lamda)*t(i));
P33(i)=(lamda^2)/(lamda+mu)*((2*exp(-2*mu*t(i)))-(2*exp(-(mu+lamda)*t(i)))-exp(-2*(mu+lamda)*t(i))+1);
end
A=P11;
B=P33;
C=P22;
plot(t,A,t,B,t,C)
legend({'A','B','C'})
  1 Comment
Mariam Gasra
Mariam Gasra on 15 Apr 2019
thanks for answer
i have another prpblem
in graph line B must start from zero not from 0.2
how can i solve this problem?

Sign in to comment.

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!

Translated by