日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

MTM:matlab实现3谱功率计算

發布時間:2025/3/15 循环神经网络 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MTM:matlab实现3谱功率计算 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

前言

之前講了MTM(多錐形窗譜估計)的相關原理,現在來分析一下它的matlab實現。
想要復習的可以參考一下之前的文件:
現代譜估計:多窗口譜
想要復習一下如何實現的可以參考:
MTM:matlab實現1MTM:matlab實現1
MTM:matlab實現2參數解析MTM參數解析

目錄

  • 前言
  • 目錄
  • 正文

正文

子函數的講解即將收尾,現在是最后一個,多窗口譜計算函數。
輸入
x 數據向量
params,pmtm傳遞的參數,除了輸入x
它包含以下值域
nfft,評估功率譜的具體頻率點
Fs 采樣頻率
range 單邊還是雙邊
ConfInt 置信間隔 默認0.95
mtmmethod多窗口譜方法,默認自適應
E,dpss矩陣
V 包含dpss序列中心的向量
NW 時間帶寬乘積
輸出
s MTM計算出的功率譜
k 構建pxx的加窗數
w dft計算的頻率點

%---------------------------------------------------------------------- function [S,k,w] = mtm_spectrum(x,params) %MTM_SPECTRUM Compute the power spectrum via MTM. % % Inputs: % x - Input data vector. % params - Structure containing pmtm's input parameter list, except for % the input data sequence, x; it contains the following fields: % nfft - Number of frequency points to evaluate the PSD at; % the default is max(256,2^nextpow2(N)). % Fs - The sampling frequency; default is 1. % range - default is 'onesided' or real signals and 'twosided' for % - complex signals. % ConfInt - Confidence interval; default is .95. % MTMethod - Algorithm used in MTM; default is 'adapt'. % E - Matrix containing the discrete prolate spheroidal % sequences (dpss). % V - Vector containing the concentration of the dpss. % NW - Time-bandwidth product; default is 4. % % Outputs: % S - Power spectrum computed via MTM. % k - Number of sequences used to form Pxx. % w - Frequency vector for which DFT is calculated從輸入中提取相關的參數 % Extract some parameters from the input structure for convenience. nfft = params.nfft; E = params.E; V = params.V; Fs = params.Fs; 如果沒有采樣頻率,則默認為歸一化頻率2pi if isempty(Fs)Fs = 2*pi; end 列向量計算MTM,每一列是一個單獨的采樣。 行數即采樣點數,列數即獨立信號個數 N = size(x,1); Nchan = size(x,2); 采用的多窗口的窗口個數 k = length(V); 如果nfft不是一個整數而是一個列向量,則代表它是想要計算的點。 if length(nfft) > 1, isfreqVector = true; nfft_mod = length(nfft); else isfreqVector = false;nfft_mod = nfft; end 如果x是single,則信號功率譜也是single if isa(x,'single') || isa(E,'single')S = zeros(nfft_mod, Nchan, 'single'); elseS = zeros(nfft_mod, Nchan); end 對于每一個信號源 for chan=1:Nchan 計算加窗 離散傅里葉% Compute the windowed DFTs.如果指定輸入頻率向量或者不指定且N采樣個數小于設定的NFFT點數if (~isfreqVector && N<=nfft) || isfreqVector 計算每一列的加窗fft變換% Compute DFT using FFT or Goertzel使用基本函數,快速計算加窗后的離散傅里葉變換[Xx,w] = computeDFT(bsxfun(@times,E(:,1:k),x(:,chan)),nfft(:),Fs); sk是xx的能量值 Sk = abs(Xx).^2;else % Wrap the data modulo nfft if N > nfft. Note we cannot use datawrap % and FFT because datawrap does not support matrices% use CZT to compute DFT on nfft evenly spaced samples around the% unit circle:Sk = abs(czt(bsxfun(@times,E(:,1:k),x(:,chan)),nfft(:))).^2; 獲得對應的頻率點w = psdfreqvec('npts',nfft,'Fs',Fs);end 計算多窗口譜估計,在0:NFFt上計算整個特征譜。% Compute the MTM spectral estimates, compute the whole spectrum 0:nfft.switch params.MTMethod, 自適應的情況:case 'adapt' 設置決定自適應的權重的代數% Set up the iteration to determine the adaptive weights: 初始功率譜,第一列的平方和/數量sig2=x(:,chan)'*x(:,chan)/N; % Power加窗1和加窗2的平均值作為初始值Schan=(Sk(:,1)+Sk(:,2))/2; % Initial spectrum estimate S1=zeros(nfft_mod,1); % The algorithm converges so fast that results are% usually 'indistinguishable' after about three iterations.% This version uses the equations from [2] (P&W pp 368-370).% Set tolerance for acceptance of spectral estimate:tol=.0005*sig2/nfft_mod;a=bsxfun(@times,sig2,(1-V));% Do the iteration:while sum(abs(Schan-S1)/nfft_mod)>tol% calculate weightsb=(Schan*ones(1,k))./(Schan*V'+ones(nfft_mod,1)*a'); % calculate new spectral estimatewk=(b.^2).*(ones(nfft_mod,1)*V');S1=sum(wk'.*Sk')./ sum(wk,2)';S1=S1';Stemp=S1; S1=Schan; Schan=Stemp; % swap S and S1endcase {'unity','eigen'}% Compute the averaged estimate: simple arithmetic averaging is used. % The Sk can also be weighted by the eigenvalues, as in Park et al. % Eqn. 9.; note that the eqn. apparently has a typo; as the weights% should be V and not 1/V.if strcmp(params.MTMethod,'eigen')wt = V(:); % Park estimateelsewt = ones(k,1);endSchan = Sk*wt/k;endS(:,chan) = Schan; end

總結

以上是生活随笔為你收集整理的MTM:matlab实现3谱功率计算的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。