Symbolic variables in a for loop

1 visualización (últimos 30 días)
Nikolas Spiliopoulos
Nikolas Spiliopoulos el 12 de Nov. de 2018
Hi all,
I am trying to create a sum of, which has x and I want to create a for loop to give me the result below :
A= [x(2:N)-x(1:N-1)] + [x(2+N:2*N)-x(1+N:2*N-1)]+ ......
So I want to create something like that:
if true
j=1;
for i=0:5 %let's say I want the dum of the first five
B=(x(2+N*i):j*N)-(x((1+N*i):j*N-1))) %Something like that, so I can sum them
j=j+1
end
Is it possible, to do it ?
Thanks

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by