From charlesreid1

% Store the coefficient vector in b
b = response_surface.beta;                                           

% Loop over all terms in the polynomial         
response_surface_value = 0;                                          
for kk=1:size(model,1) 
            
    % Loop over all variables that are part of a given polynomial term
    polyprod = 1;
    for nn=1:size(model,2)
                
        % This can be streamlined better, but I'll let you figure out how to do that
        if( nn == 1 )
            polyprod = polyprod*x1^(model(kk,nn));                   
        elseif ( nn == 2 )
            polyprod = polyprod*x2^(model(kk,nn)); 
        elseif ( nn == 3 )                                           
            polyprod = polyprod*x3^(model(kk,nn));
        elseif ( nn == 4 )                                           
            polyprod = polyprod*x4^(model(kk,nn));                   
        elseif ( nn == 5 )                                           
            polyprod = polyprod*x5^(model(kk,nn));                   
        elseif ( nn == 6 )
            polyprod = polyprod*x6^(model(kk,nn));
        end                                                          
    end                                                              
        
    response_surface_value = response_surface_value + b(kk)*polyprod;
end

It would be useful to make this into a function, which could be fed to the DC toolbox.