Simulates the impact of multipath channel on the transmitted signal. function [ r ] = Channel_Multipath( s, C ) The function works for SISO and MIMO, time-invariant and time-invariant systems. Input arguments: s: transmit signal. Size: matrix [Para.N_T, nFrameSamples] C: channel impulse response. Size: multidimensional array [Para.N_R, Para.N_T, L] if time-invariant and [Para.N_R, Para.N_T, L, nFrameSamples] if time-variant. Outputs arguments: r: received signal impacted by multipath channel. Size: matrix [Para.N_R, nFrameSamples]
0001 function [ r ] = Channel_Multipath( s, C ) 0002 % Simulates the impact of multipath channel on the transmitted signal. 0003 % 0004 % function [ r ] = Channel_Multipath( s, C ) 0005 % 0006 % The function works for SISO and MIMO, time-invariant and time-invariant 0007 % systems. 0008 % 0009 % Input arguments: 0010 % 0011 % s: transmit signal. Size: matrix [Para.N_T, nFrameSamples] 0012 % 0013 % C: channel impulse response. Size: multidimensional array [Para.N_R, 0014 % Para.N_T, L] if time-invariant and [Para.N_R, Para.N_T, L, nFrameSamples] 0015 % if time-variant. 0016 % 0017 % Outputs arguments: 0018 % 0019 % r: received signal impacted by multipath channel. Size: matrix [Para.N_R, 0020 % nFrameSamples] 0021 % 0022 0023 0024 % This file is part of WaveComBox: www.wavecombox.com and is distributed under 0025 % the terms of the MIT license. See accompanying LICENSE file. 0026 % Original author: François Rottenberg, May 3, 2018. 0027 % Contributors: 0028 % Change log: 0029 0030 temp=size(C); 0031 N_R=temp(1); 0032 N_T=temp(2); 0033 if ndims(C)==3 0034 L=temp(3); 0035 else 0036 L=1; 0037 end 0038 r=zeros(N_R,length(s(1,:))); 0039 0040 if length(temp)==4 % meaning that the channel is time-varying 0041 nFrameSamples=length(s(1,:)); 0042 for index_N_R=1:N_R 0043 for n=1:L 0044 for b=1:L 0045 if(n-(b-1)>0) 0046 r(index_N_R,n)=r(index_N_R, n)+C(index_N_R,:,b,n)*s(:,n-(b-1)); 0047 end 0048 end 0049 end 0050 for n=L+1:nFrameSamples 0051 for b=1:L 0052 r(index_N_R,n)=r(index_N_R, n)+C(index_N_R,:,b,n)*s(:,n-(b-1)); 0053 end 0054 end 0055 end 0056 else % meaning that the channel is time-invariant 0057 for index_N_R=1:N_R 0058 for index_N_T=1:N_T 0059 r(index_N_R,:)=r(index_N_R,:)+filter(squeeze(C(index_N_R,index_N_T,:)),1,s(index_N_T,:)); 0060 end 0061 end 0062 end 0063 0064 0065 0066 end 0067