So im trying to figure out how to be able to use,
parameters = {[6 12 18 24], [1200 1800 2400 3000], [80 90 100],[80 90 100],[80 90 100]};
[r T3 Ec Et Er ] = ndgrid(parameters{:});
Allcombinations = [r(:) T3(:) Ec(:) Et(:) Er(:)];
this gives me all possible combinations of from my orginal parameters
I need to plug each combination of parameters into many equations is whats the best way to do that?
for example if i want to pull out the 1st row and plug the corresponding values into say for example;
%# Note: k, Cp and T1 are predefined constants
Ec1=Ec/100;
Et1=Et/100;
Er1=Er/100;
T2s=T1*(r)^((k-1)/k);
T4s=T3*(1/r)^((k-1)/k);
T2a=((T2s-T1)/Ec1)+T1;
T4a=T3-Et1*(T3-T4s);
wca=Cp*(T2a-T1);
wta=Cp*(T3-T4a);
T5s=Er1*(T4a-T2a)+T2a;
qcombustion=Cp*(T3-T5s);
qregen=Cp*(T5s-T2a);
qin=qcombustion+qregen;
fprintf ('\n Net Work Output=%6.2f', wnet)
fprintf ('\n Back Work Ratio=%4.2f', rbw)
fprintf ('\n Thermal Efficiency=%4.2f\n', Eth)
Im not sure but would I some how use Allcombinations(n,:)
I would really appreciate some help
Thank you
You can calculate everything for all possible combinations using element-wise operators in one go: