Borrar filtros
Borrar filtros

Error Message during execution

4 visualizaciones (últimos 30 días)
FG
FG el 14 de Oct. de 2020
Comentada: FG el 14 de Oct. de 2020
My Code is;
Ave3ON = zeros(size(S));
Ave5ON = zeros(size(S));
Ave7ON = zeros(size(S));
AvethdON = zeros(size(S));
Ave3OFF = zeros(size(S));
Ave5OFF = zeros(size(S));
Ave7OFF = zeros(size(S));
AvethdOFF = zeros(size(S));
for i=1:length(S)
M3=([S(i).HV3]);
M5=([S(i).HV5]);
M7=([S(i).HV7]);
Mthd = ([S(i).thd]);
Ave3ON(i)=mean(M3(90000-S(i).date*1667:90000));
Ave5ON(i)=mean(M5(90000-S(i).date*1667:90000));
Ave7ON(i)=mean(M7(90000-S(i).date*1667:90000));
AvethdON(i)=mean(Mthd(90000-S(i).date*1667:90000));
Ave3OFF(i)=mean(M3(110000:110000+S(i).date*1667));
Ave5OFF(i)=mean(M5(110000:110000+S(i).date*1667));
Ave7OFF(i)=mean(M7(110000:110000+S(i).date*1667));
AvethdOFF(i)=mean(thd(110000:110000+S(i).date*1667));
end
Error Message is;
Error using computeperiodogram>validateinputs (line 196)
The input must be either a vector or two-dimensional matrix.
Error in computeperiodogram (line 61)
[x1,~,y,is2sig,win1] = validateinputs(x,win,nfft);
Error in periodogram (line 215)
[Sxx,w2,RSxx,wc] =
computeperiodogram(x,win,nfft,esttype,Fs,options);
Error in thd>timeTHD (line 126)
[Pxx, F] = periodogram(x,w,n,fs,'psd');
Error in thd (line 89)
[r, harmPow, harmFreq] = timeTHD(plotType, harmType,
varargin{:});
Error in Untitled2 (line 28)
AvethdOFF(i)=mean(thd(110000:110000+S(i).date*1667));
Struct S =
480×1 struct array with fields:
name
date
HV3
HV5
HV7
thd

Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Oct. de 2020
Ave3ON(i)=mean(M3(90000-S(i).date*1667:90000));
Ave5ON(i)=mean(M5(90000-S(i).date*1667:90000));
Ave7ON(i)=mean(M7(90000-S(i).date*1667:90000));
AvethdON(i)=mean(Mthd(90000-S(i).date*1667:90000));
Okay, parallel indices into 4 different arrays. Makes sense.
Ave3OFF(i)=mean(M3(110000:110000+S(i).date*1667));
Ave5OFF(i)=mean(M5(110000:110000+S(i).date*1667));
Ave7OFF(i)=mean(M7(110000:110000+S(i).date*1667));
Okay, parallel indices into 3 of the 4 different arrays from above. That's odd, I wonder why the 4th array isn't being used?
AvethdOFF(i)=mean(thd(110000:110000+S(i).date*1667))
The destination location parallels the block of 4 above, and the code structure parallels the three lines above it, but why have you suddenly switched from indexing an array named Mthd, to instead requesting the calculation of Total Harmonic Distortion (thd) ?
  1 comentario
FG
FG el 14 de Oct. de 2020
Thank you Walter.. It wad just a mistyping and it's solved : )

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by