function [x] = var_decode(x_norm, bounds) % VAR_DECODE - Decodes the normalized variables x_norm into a normal float representation % % Inputs: % x_norm = [ number_of_samples x N_var ] input matrix of normalized variables to be decoded % bounds = [ number_of_variables x 2 ] input matrix where the ith row is the valid bounds for the ith variable % % Outputs: % x = [ number_of_samples x N_var ] unnormalized encoding of each variable % % Written by: % -- % John L. Weatherwax 2006-08-28 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- % Check inputs: assert( size(bounds,2)==2, 'bounds input must have two columns' ); N_var = size(bounds,1); N_samples = size(x_norm,1); % Compute the decoded variables: % x_low = repmat( bounds(:,1), [1,N_samples] ).'; x_len = repmat( bounds(:,2) - bounds(:,1), [1,N_samples] ).'; x = x_norm .* x_len + x_low;