# R2013a RF toolbox: How do I smooth the parameters of an S-parameter object

11 views (last 30 days)
How can I smooth the parameters of an S-parameter object?

MathWorks Support Team on 12 Aug 2020
Edited: MathWorks Support Team on 12 Aug 2020
You can filter the parameters of the object by deconstructing the complex signals into the magnitude, angle representation. You can then apply a filter to the magnitude vector then reconstruct complex signal and insert the filtered parameters back into the S-parameter object. An example function is attached.
See the following documentation page for more information on the 'filter' function:

De Zhou on 14 Aug 2018
If the complex signals are deconstructed into the real and imag representation, the smoothing results are better.
function S_obj = sParamFilter(file , i , j) %%function returns an S parameter object (S_obj) given a s2p filename %%(file) and the row (i) column number (j) of the S parameter to filter
%%create S parameter object S_obj = sparameters(file);
%%extract the desired row/column pair of the S parameter matrix vector sp = S_obj.Parameters(i , j , :); sp = sp(:);
%%get the magnitude and frequency equivalent of the complex number R = real(sp); I = imag(sp);
%%filter the magnitudes R_s= smooth(R,100); I_s= smooth(I,100);
%%recreate the complex number using euler's formula and assign it backk %%into the S parameter object S_obj.Parameters(i , j , :) = R_s+1i*I_s;
%%plot the gain against frequency of the object rfplot(S_obj , i , j);
end

R2013a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by