Effacer les filtres
Effacer les filtres

how to display all iterations in one matrix...below is the code which i run and get the value of z in separate vectors..how to combine them in one.

1 vue (au cours des 30 derniers jours)
DP1=100;
DP2=200;
PP1=[2 4;3 5;4 1];
PP2=[1 3;2 2;3 1];
POWER=[3;5;4];
C=0.5;
E1=sum(bsxfun(@times,PP1,POWER));
E2=sum(bsxfun(@times,PP2,POWER));
for x=E1;
for y=E2;
f=C*(DP1*x+DP2*y);
z=[x y f]
end
end
---------
z =
37 25 4350
z =
37 23 4150
z =
41 25 4550
z =
41 23 4350

Réponse acceptée

Mischa Kim
Mischa Kim le 11 Déc 2016
Quick and dirty:
z = [];
for x = E1
for y = E2
f = C*(DP1*x+DP2*y);
z = [z; x y f]
end
end

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by