function transformed_grid = transform_grid(gridpts,grid_bounds)
nDim = size(gridpts,1);
transformed_grid = zeros(size(gridpts));
for i=1:nDim
transformed_grid(i,:) = (grid_bounds(i,2)-grid_bounds(i,1))/2 * gridpts(i,:) + (grid_bounds(i,2)+grid_bounds(i,1))/2;
end

%plots the transformed grid points in dimensions 2 or 3
figure();
if nDim==2
    grid_x = transformed_grid(1,:);
    grid_y = transformed_grid(2,:);
    plot(grid_x,grid_y,"*");
elseif nDim==3
    grid_x = transformed_grid(1,:);
    grid_y = transformed_grid(2,:);
    grid_z = transformed_grid(3,:);
    plot3(grid_x,grid_y,grid_z,"*");
end
