|
| Alright, I have found a work around but I still don't have an answer to
why this should be a problem. Is this a bug in MATALB? What's the best
way of reporting bugs - probably in the help somewhere.
Anyways, I think that the handles.psdOpts is somehow being modified
each time a call is made to psd. I made the following changes to the
code and it works fine:
function GUI_OpeningFcn(hObject, eventdata, handles, varargin)
.....
handles.psdObj = spectrum.burg(10);
.....
function [PSDData, AvgPower] = ProcessData(dataChunk, hObject, handles)
% Resample data
DataResampled = resample(dataChunk,800,6000);
% Compute psd
hopts = psdopts(handles.psdObj); % Default options.
set(hopts,'NFFT',1024,'Fs',800,'Spectrum
Type','onesided');
psdstruct = psd(handles.psdObj,DataResampled,hopts);
.....
Basically, I have to reset the options everytime the function is
called. But storing the actual burg object seems to work fine.
|
|