loop in sum series and product
2 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189492/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189493/image.png)
P_MG=0.2*heaviside(s-2).*(1-exp(-0.05*s)); P_ME=P_GE=0.05*heaviside(s-3).*(1-exp(-0.05*s));
Hi How I do loop command for this picture? thanks
回答(1 个)
Birdman
2018-4-16
编辑:Birdman
2018-4-16
You don't need a for loop. If you have Symbolic Toolbox, you can easily calculate it as:
syms t n l=3;m=6;k=3; %random upper limits for each series Pmg(t)=0.2*heaviside(t-2).*(1-exp(-0.05*t)); Pme(t)=0.05*heaviside(t-3).*(1-exp(-0.05*t)); Pge(t)=0.05*heaviside(t-3).*(1-exp(-0.05*t)); Res=symsum((symprod((1-Pmg(t))*(1-Pme(t)),t,1,l))*Pmg(l)*(symprod((1-Pge(t)),t,l+1,m)),n,1,k); %symbolic answer will be displayed. If you want numeric, just type double(Res)
You first calculate the product and then sum. In product, you calculate the value of function for t values. Hope this helps.
4 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Number Theory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!