function [H, PG] = genChannelDrop(par, v, samples_per_sec) % Distance dist_tot = v * par.sequenceLength / samples_per_sec; samples_per_meter = 1 / (dist_tot / par.sequenceLength); % par.l.simpar.samples_per_meter = samples_per_meter; not necessary % Create tracks for i = 1:par.l.no_rx name = par.l.track(1, i).name; par.l.track(1, i) = qd_track('linear', 1/samples_per_meter*(par.sequenceLength - 1)); par.l.track(1, i).name = name; par.l.track(1, i).scenario = 'BERLIN_UMa_NLOS'; end % Add random positions distances = sqrt(rand(1, par.l.no_rx)*(par.maxDistance^2 - par.minDistance^2)+par.minDistance^2); angles = (2 * rand(1, par.l.no_rx) - 1) * par.sectorAngleRad; par.l.rx_position = [cos(angles) .* distances; sin(angles) .* distances; 1.5 .* ones(1, par.l.no_rx)]; for i = 1:par.l.no_rx par.l.track(1, i).movement_profile = ... [0, 1 / samples_per_meter * (par.sequenceLength - 1) / v; ... 0, 1 / samples_per_meter * (par.sequenceLength - 1)]; par.l.track(1, i).interpolate('time', 1/samples_per_sec); end % for i=1:par.l.no_rx % a = par.l.track(1,i).initial_position+par.l.track(1,i).positions; % if sum(abs(atan(a(2,:)./a(1,:))) > par.sectorAngleRad) % disp('Out of sector angle') % i % end % if sum(sqrt(a(1,:).^2+a(2,:).^2) > par.maxDistance) % disp('Out of range r') % i % end % end % Get channel impulse reponses H_raw = par.l.get_channels(); % Get channels in frequency domain: only consider single carrier H = zeros(1, par.l.no_rx, par.l.tx_array.no_elements, par.sequenceLength); PG = zeros(1, par.l.no_rx); for k = 1:par.l.no_rx h = squeeze(H_raw(k).fr(par.bandwidth, 1, 1:par.sequenceLength)); pg = sqrt(10.^(0.1 * H_raw(k).par.pg_parset)); h = h / pg; % Visualize channels % figure % surf(real(h), 'EdgeColor', 'None'); % view(2) % title('Real part CSI sample sequence') % xlabel('shapshots') % ylabel('BS antennas') % figure % surf(imag(h)); % view(2) % title('Imag part CSI sample sequence') % xlabel('n shapshots') % ylabel('BS antennas') H(1, k, :, :) = single(h); PG(1, k) = single(pg); end H = {H}; PG = {PG}; end