Now, I am trying to build a noise cancelling system for
headphone in simulink. There is a block which should use a
microphone's transfer function. I test the microphone's
transfer function and get the frequency response data from
150hz to 5k hz with 130 points. And now, I don't know how to
convert the data to simulink's block, so it can work as a
microphone's behavior. I tried system identification
toolbox. But it doesn't work by now. I am just confused how
to do it.
You might get help if you state specifically what block
you try to use.
Rune
There is a block in my system that represent the microphone.
I want it to behavior like the microphone I use. Thus, I
test the microphone'r frequency response by a function
generator and a scope. Now, I want to convert the data I got
to the block.
maybe firls could be of help
thanks.
you mean the function "firls"?
Rajiv
"Ben Wu" <wushi...@gmail.com> wrote in message
news:g9p0rm$o6j$1...@fred.mathworks.com...
yes, with that i think you could take your measured
response curve and get the coefficients for an fir filter
to pass the sound through to get the response of your mic.
Sure. Thanks for reply.
I have three vectors: magnitude, phase, frequency. I import
these data as freq.frequency(amp/phase). Then I estimate it
by using spectral model. Finally, I get IDFRD model and do
not what to do next.
H = mag.*exp(j*phase);
G = idfrd(H,w); %w is fequency in rad/s
(make sure the phase is in rad.)
Then you may estimate paramteric models using G as data. If you want
continuous-time models, you can set the sample time to zero in G (G.Ts=0),
or use "process models" (see M4 below).
M1 = oe(G, [2 2 1]); %get output error model: y = B/F*u+e, with 2 poles and
one zero
M2 = pem(G,4); % 4th order state-space model
M3 = arx(G, [2 2 1]); %arx model: Ay = Bu+e
M4 = pem(G,'p2dz'); % get a continuous-time process model
Note:
1. Commands such as ARX, OE, PEM ordinarily create discrete-time models. If
you want continuous-time models, you can either set G.Ts to 0 or use D2C on
the discrete model after estimation.
2. The model M4 above is "process model" which is basically a
continuous-time transfer function. It has the advantage that it allows delay
estimation. Its limitation is that is only allows low-order transfer
function estimation (3 or fewer poles, one zero, input delay and
integrator). G.Ts must be non-zero for estimating this model. Look up help
for IDPROC for more information.
3. All of these models can be imported into Simulink using the IDMODEL block
that is part of System Identification Toolbox block library.
4. You can convert these models into LTI objects, such as a trasnfer
function by using "tf" command, as in: mod = tf(M1('m')); The LTI model can
be imported into SImulink using the LTI block of Control System Toolbox.
5. You can also extract numerator and denominator coefficients for any of
these models using "tfdata", as in: [num, den] = tfdata(M1, 'v'); The "num"
and "den" values can be used in core Simulink's "Transfer fcn" and "Discrete
transfer fcn" blocks. There are also continuous and discrete state space
blocks for representing a LTI system using state-space matrices. Use
"ssdata" function to extract state-space matrices from any estimated model.
So you have several options to estimate models and also several options for
importing results into Simulink.
Rajiv
"Ben Wu" <wushi...@gmail.com> wrote in message
news:g9pb3q$pmi$1...@fred.mathworks.com...
Thanks so much.But the transfer function I got all have poles>0. So, they are unstable.For example, I got Continuous-time IDPOLY model:
y(t) = [B(s)/F(s)]u(t) + e(t)
B(s) = 355.2 s + 3.487e006
F(s) = s^2 - 7283 s + 5.451e008
I tried other orders and got poles>0.
http://www.mathworks.com/products/connections/product_main.html?prod_id=309
http://matlab.gamax.hu/english/products/?article_hid=219
but it is not free.
unfortunately many of the good things in life aren't free.
model = oe(G,[2 2 1],'foc','stab');
The process models (idproc) are always stable.
Rajiv
"Ben Wu" <wushi...@gmail.com> wrote in message
news:ga9vjq$fko$1...@fred.mathworks.com...
Yes, that makes transfer function stable. But the thing is that the phase response is not correct now.
My version of Matlab doesn't seem to accept IDFRD objects for oe, pem, or arx. I'm using version MatLab 6.5 and the system identification toolbox version 5.0. pem() complains that OutputData must be a 2D matrix. arx() complains that NN must be the same number of columns as inputs. Am I missing a step, or do I need to user a newer version matlab?
Rajiv
"Gary Pratt" <gp_remo...@wi.rr.com> wrote in message
news:gfss5g$ja$1...@fred.mathworks.com...