Get transfer function from frequency response

8 views (last 30 days)
Hi,
I am simulating a system which contains A/D converters and I would like my simulator to emulate these converters as close as possible (data truncation, frequency response, spurious bias).
So far, my simulator truncates the input data using the fixed point library (easy part).
I would like my block to "color" white noise processes, according to some user specifications. In order to implement that I did something really naive:
yf=[-0.99 -130 -130]; % amplitudes specified by user [dB]
xf=[1 300e3 fnyquist]; % given frequency points [Hz]
% log. interpolation between points 1,2 (interpolate missing frequency points)
xp0f = xf(1):xf(2)/512:xf(2);
yp0f = interp1(log10(xf(1:2)),yf(1:2),log10(xp0f));
% log. interpolation between points 2,3 (interpolate missing frequency points)
xp1f = xf(2):xf(3)/512:xf(3);
yp1f = interp1(log10(xf(2:3)),yf(2:3),log10(xp1f));
xpf=[0 xp0f xp1f]; % frequency axis
ypf=[0 yp0f yp1f]; % frequency response model
figure;
semilogx(xpf,20*log10(ypf));
At this point you can see the typical kind of frequency responses I want to emulate.
Now I need to get the transfer function from ypf so my block can apply it.
I have to say I am far from being familiar with the Identification Toolbox, although system identification is closer to what I studied, I have never used it.
So what I want to emulate is a response to white noise, maybe I could build the proper iddata object and do some relevant identification with it:
u = rand(1024); % input
y = ypf; % output is response previously built
idDataObj = iddata(y,u(1,:),1/fs'); % object for identification to come
sysest = ssest(idDataObj,2,'Ts',1/fs); % estimate an LTI system
.. get transfer function from that?
I also noticed the idfrd "frequency response model" which might be what I am looking for:
frdobj = idfrd(ypf,xpf,1/fs);
modelobj = arx(frdobj,[2 1 0]); % but then I need to determine the [na nb nk] parameters
modeltf = tf(modelobj);
a = cell2mat(get(modeltf,'Numerator'));
b = cell2mat(get(modeltf,'Denominator'));code
1/ Can you guys let me know what you think of my approach, there might be an easier one and I am sure I am missing a few things.
2/ as far as the second method goes, "idfrd+ARX" thing, could you elaborate on how to determine the proper set of parameters "[na nb nk]" to be passed to ARX([na nb nk])? I think these come from some "step-response" estimate which I am far from being familiar with
2/ How would you estimate [a,b]: numerator and denominator of the transfer function of a system whose frequency response is very close to "ypf", the one I just built?
In the end I just want to do something like: y = filter(b,a,input);

Answers (0)

Community Treasure Hunt

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

Start Hunting!