Re: Phase plot problems
- From: Bas <wegwerp@xxxxxxxxx>
- Date: Thu, 10 Apr 2008 06:08:51 -0700 (PDT)
I'm calculating the transfer function between input andHow are you calculating your transfer function? That fact that you use
output signals. My inputs to the system were Gaussian white
noise. Therefore, the magnitude and phase plots I obtain
were very noise (even with a large number of samples).
noise has nothing to do with obtaining a noisy transfer function.
Injection (white/colored) noise into a system is actually a pretty
common way to measure transfer functions. Have a look at the function
'tfestimate' and play with the number of averages. By increasing the
number of averages you can get a very accurate transfer function
(given enough coherence, stationary of you system, ...).
Also, I'm using FFT averaging to reduce the noiseSee tfestimate mentioned before. Don't write you own code, it takes
variation.
some effort to get all the details right.
This is an issue for the phase plot, because even though I
can barely see a general trend in the plot, there are a
lot of noise samples between +pi and -pi through out the
graph. I can't even use phase unwrapping because of the
large jump in angles.
If the lines jumping from +-pi are the problem are the problem why not
simply plot the points (e.g. semilogx(f,phi,'.'). If you insist on
using a solid line, you might use this function:
function [tgap,pgap] = phasegap(t,p)
%function [tgap,pgap] = phasegap(t,p)
%inserts a NaN where diff(p) > pi in both t and p to create a gap in
the plot:
%[tg,pg] = phasegap(t,p); semilogx(tg,pg)
jumpIndex = find(abs(diff(p))>pi);
jumpIndex = [0;jumpIndex;length(jumpIndex)];
pgap = NaN(length(p)+length(jumpIndex),1);
tgap = pgap;
for k = 1:length(jumpIndex)-1;
tgap(jumpIndex(k)+1+k-1:jumpIndex(k+1)+k-1) = t(jumpIndex(k)
+1:jumpIndex(k+1));
pgap(jumpIndex(k)+1+k-1:jumpIndex(k+1)+k-1) = p(jumpIndex(k)
+1:jumpIndex(k+1));
end
If anyone nows how to vectorize the for-loop, I would be glad to hear
it.
HTH,
Bas
.
- Follow-Ups:
- Re: Phase plot problems
- From: Ian James
- Re: Phase plot problems
- References:
- Phase plot problems
- From: Ian James
- Phase plot problems
- Prev by Date: Re: OCR on Tank Cars - Any Experience?
- Next by Date: Need Help in fitting; Min F= (f(x1 xdata) -Y1data)^2 + (f(x2 xdata) - Y2data) ^2
- Previous by thread: Phase plot problems
- Next by thread: Re: Phase plot problems
- Index(es):
Relevant Pages
|
Loading