Periodogram signal 1 Hz resolution using FFT
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Javier Naranjo
el 22 de Ag. de 2017
Respondida: Eeshan Mitra
el 24 de Ag. de 2017
Hello everybody,
I am trying to compare two signal whit their frequency response. I've tried this code:
[P1,f1] = periodogram(original,flattopwin(length(original)),[1:fs/2],fs,'power');
I want to do the same (periodogram with 1 Hz resolution) using FFTs because I cannot coder this functions.
Thanks in advance,
Javier
0 comentarios
Respuesta aceptada
Eeshan Mitra
el 24 de Ag. de 2017
Functions that are not supported by codegen can still be run in MATLAB from the generated code when "coder.extrinsic" is included in the function definition. Please find more information about using "coder.extrinsic" in the following documentation link:
For example, lets assume the following simple function that is built for code generation for a signal x of size(1,1000), and a scalar sample rate:
function [P1,f1] = pdgram (x,fs)
%#codegen
coder.extrinsic('periodogram');
[P1,f1] = periodogram(x,flattopwin(length(x)),[1:fs/2],fs,'power');
Generate code for this function using the following command:
>> codegen pdgram -args {zeros(1,1000,'double'),1000}
The difference is that the generated code calls MATLAB to access "periodogram".
However, if you want to perform the calculations for "periodogram" within the generated code using an "fft" implemention, please read more about its algorithm in the following documentation link:
Note that Variable-sizing restrictions apply to the function "fft". Please find more information about Variable-sizing in the following documentation link:
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Spectral Measurements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!