Implement double summation in Matlab
36 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi.
Could you help me implement these two equations in Matlab utilizing for loops?
SF is a matrix of 1400 rows and 120 columns.
N=120
t=1:1400
I think the first equation can be implemented with cumsum(SF,2) but I'm curious as to how it'd be with foor loops.


Thanks
0 comentarios
Respuestas (2)
Rik
el 14 de Dic. de 2020
Editada: Rik
el 14 de Dic. de 2020
The sigma symbol contains all syntactic elements that you need for a for loop:
y=0;%initialize to 0
for j=1:N
for i=1:j
y=y+f(i);
end
end
4 comentarios
Rik
el 14 de Dic. de 2020
Editada: Rik
el 14 de Dic. de 2020
Maybe cumprod is what you're looking for there? If you think about what should happen mathematically, that operator mean to take the product of all elements, right? That would make it analogous to the sigma operator, which uses + on all operators. Note that while 0 is the null operand for sum (or is it called unit operand?), for a product that operand is 1.
aisha chauhan
el 27 de Mayo de 2023
Editada: Image Analyst
el 27 de Mayo de 2023
Please convert this equation into MATLAB code:

1 comentario
Image Analyst
el 27 de Mayo de 2023
Try a nested for loop:
theSum = 0;
for ii = 1 : Ncl
for ell = 1 : Nray
aHt = at(phi(ii, ell)^t, theta(ii, ell)^t)
theSum = theSum + alpha(ii, ell) * ar(phi(ii, ell)^r, theta(ii, ell)^r) * aHt^H
end
end
H = gamma * theSum;
But the equation seems weird, or maybe the nomenclature was just not explained. Like why are you raising a sub t to the H power when H is the result of the loop? To learn other fundamental concepts, invest 2 hours of your time here:
If you still have trouble, start your own question instead of posting in some 3 year old thread of @Jean Pazos's.
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
