MATLAB BUILDER EX 1 Guía de usuario Pagina 71

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 182
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 70
Spectral Analysis Example
4-19
powerspect = [];
return;
end
if (interval <= 0)
error('Sampling interval must be greater then zero');
return;
end
fftdata = fft(data);
freq = (0:length(fftdata)-1)/(length(fftdata)*interval);
powerspect = abs(fftdata)/(sqrt(length(fftdata)));
plotfft.m:
function [fftdata, freq, powerspect] = plotfft(data, interval)
[fftdata, freq, powerspect] = computefft(data, interval);
len = length(fftdata);
if (len <= 0)
return;
end
t = 0:interval:(len-1)*interval;
subplot(2,1,1), plot(t, data)
xlabel('Time'), grid on
title('Time domain signal')
subplot(2,1,2), plot(freq(1:len/2), powerspect(1:len/2))
xlabel('Frequency (Hz)'), grid on
title('Power spectral density')
To proceed with the actual building of the component, follow these steps:
1 Start mxltool. See Graphical User Interface Menus on page 2-2 for a
discussion of using
mxltool to build a COM component from a collection of
MATLAB M-files.
2 Create a new project with these settings:
Component name: Fourier
Class name: Fourier
Project version: 1.0
Check Use Handle Graphics library.
Vista de pagina 70
1 2 ... 66 67 68 69 70 71 72 73 74 75 76 ... 181 182

Comentarios a estos manuales

Sin comentarios