How can I add x1 to x5 in a loop
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
TRISHITA BANERJEE
el 13 de Jul. de 2018
Respondida: Dennis
el 13 de Jul. de 2018
x(j) = [zeros(t(j),1);x_m';zeros(t_max -t(j),1)];
x1 = x(:,1);
x2 = x(:,2);
x3 = x(:,3);
x4 = x(:,4);
x5 = x(:,5);
y_m = x1+x2+x3+x4+x5;
0 comentarios
Respuesta aceptada
Dennis
el 13 de Jul. de 2018
You can use sum() instead of manually adding x1 to x5.
y=zeros(length(t),5);
for j=1:length(t)
y_m(j,:)=sum(x);
end
However i don't think that your calculation of x(j) is going to work that way.
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!