In: Electrical Engineering
Consider the user-defined MATLAB function below,
ht_mp_ch().
The function ht_mp_ch(), outputs the sampled version of the impulse
response hmp(t) of the multipath fading channel as a
vector.
function
impulse_response=ht_mp_ch(max_delay,L,decay_base,t_step)
t_vector=0:t_step:max_delay;
mp_tmp=0*(t_vector);
path_delays=[0 sort(rand(1,L-1)*max_delay)];
impulse_positions=floor(path_delays/t_step);
mp_tmp(impulse_positions+1)=exp(j*2*pi*rand(1,L));
mp_tmp=mp_tmp.*(decay_base.^(t_vector/max_delay));
impulse_response=mp_tmp/sqrt(sum(abs(mp_tmp).^2));
Explain what the variable on the left-hand side represents and
justify how the right-hand side expression is formulated by adding
comments to every line.
The above given code in MATLAB which defines and represents as follows:
ht_mp_ch() is a syntax code which is written for a variable
ht_mp_ch() is a variable in which// ht_ denotes a vector and mp_ denotes multipath and ch_ represents channel. in other words it is a multipath fading channel vector.
function impulse_response=ht_mp_ch(max_delay,L,decay_base,t_step)
//The above function represents on impulse function plotting graph = multipath fading vector what is the maximum delay time to be set and decay base time and unit step time and total length L
t_vector=0:t_step:max_delay;
//for each step giving or setting maximum delay
impulse_positions=floor(path_delays/t_step)
//for plotting impulse function the positions setting with path delays with step by step
mp_tmp(impulse_positions+1)=exp(j*2*pi*rand(1,L));
//this represents based on which exponential values it has to increase and decrease the value for multipath in a maximum length L
mp_tmp=mp_tmp.*(decay_base.^(t_vector/max_delay));
// it is a decay base means the value where it has to decrease the graph and the vector to maximum delay value
impulse_response=mp_tmp/sqrt(sum(abs(mp_tmp).^2));
//the above is the final plotting graph in impulse by using the above formula