# loop in sum series and product

5 Ansichten (letzte 30 Tage)
Osamah Alayafi am 16 Apr. 2018
Kommentiert: Osamah Alayafi am 17 Apr. 2018
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 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Jan am 16 Apr. 2018
It depends on what "P_MG(s)" is. Please provide any details.

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Birdman am 16 Apr. 2018
Bearbeitet: Birdman am 16 Apr. 2018

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 Kommentare2 ältere Kommentare anzeigen2 ältere Kommentare ausblenden
Birdman am 17 Apr. 2018
Osamah Alayafi am 17 Apr. 2018
Thank you very much for your answer. I have done them by myself using different way and I obtained the result that I was looking for. Regards.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Number Theory finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by