For Programmers: Free Programming Magazines  


Home > Archive > Matlab > December 2005 > Re: trouble with spectrum object in SP toolbox









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: trouble with spectrum object in SP toolbox
J.D.

2005-12-09, 7:26 pm

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.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com