[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: RMS Waveform of a signal



Hello all:

Thanks so much to all for all responses.

El 16/06/10 20:52, Richard Balogh escribió:
In octave/matlab:

y = sqrt(sum(u.*conj(u))/size(u,1))

When You need RMS in certain interval D, just split the vector
and repeat for each D...

Let's go to do the real test:

octave:1> simu4=load Salida.S4.Tran.dat ;
octave:2> tiempo=simu4(:,1);
octave:3> i_neutro=simu4(:,2);
octave:4> length(i_neutro)
ans =  3334
octave:5> valor_rms=sqrt(sum(i_neutro.*conj(i_neutro))/size(i_neutro,1))
valor_rms =  26.597

Ok, these 26.597 are the expected (and it can be calculated, and checked, too with Gnucap)

Now, in how many intervals we should split to preserve accuracy?

Length vector is 3334, step time in analysis was 50us, split into 100us should be a good election?

Trying (sorry for this horrible code):

octave:16> i=1
i =  1
octave:21> l=1
l =  1
octave:22> while (i <= length(i_neutro))
> z=1
> while (z <=2)
> interno(z,1)=i_neutro(i,1)
> z++
> i++
> endwhile
> wave_rms(l,1)=sqrt(sum(interno.*conj(interno))/size(interno,1))
> l++
> endwhile
warning: broken pipe -- some output may be lost
octave:23> length(wave_rms)
ans =  1667
octave:24> plot(tiempo,onda_rms)
error: __plt2vv__: vector lengths must match
error: evaluating if command near line 59, column 3

There are some troubles, the wave_rms vector is time and i_neutro/2, which don't plot.

Should be a solution get pairs of values in form (1,2),(2,3),(3,4)...?

octave:24> i=1
i =  1
octave:25> l=1
l =  1
octave:26> while (i <= length(i_neutro))
> z=1
> while (z <=2)
> interno(z,1)=i_neutro(i,1)
> z++
> i++
> endwhile
> i--
> wave_rms(l,1)=sqrt(sum(interno.*conj(interno))/size(interno,1))
> l++
> endwhile
error: invalid row index = 3335
error: evaluating assignment expression near line 29, column 13
error: evaluating while command near line 28, column 1
error: evaluating while command near line 26, column 1
warning: broken pipe -- some output may be lost
octave:26> length(wave_rms)
ans =  3333
octave:27> length(tiempo)
ans =  3334
octave:28> wave_rms(3334,1)=wave_rms(3333,1)
octave:29> plot(tiempo,wave_rms)

These aren't the expected wave, but, wait, if I use average of the wave_rms? (In somewhere I read that RMS wave are the average of RMS values)

I use my own function write some time ago:

function retval = media_de_una_onda (v)
 retval = 0;
 if (nargin !=1)
  usage ("media_de_una_onda (vector)");
 endif
 if (isvector(v))
   retval=linspace(0,0,length(v))';
   %
   % Se crea retval con la longitud de v
   % Se hace la transpuesta ya que linspace
   % crea columnas y no filas.
   %
   retval(1,1)=v(1,1);
   suma_int=v(1,1);
   %
   % Para la primera vez no se necesita
   % ningún bucle, despues lo que vamos
   % haciendo es ir sumando los valores
   % anteriores y haciendo la media.
   %
   i=2;
   while (i <= length(v))
    suma_int=v(i,1) + suma_int
    retval(i,1) = suma_int/i;
    i++;
   endwhile
 else
   error ("media_de_una_onda: El argumento debe ser un vector")
 endif
endfunction

octave:32> avg_rms=media_de_una_onda(onda_rms)
warning: broken pipe -- some output may be lost
octave:33> plot(tiempo,avg_rms)

Ok, looks strange with many peaks, but seems "remotely" the RMS plot from comercial apps.

It's a hard way to obtain these wave.

Has someone saw some error? Or, someone wants to refine it?

Richard Balogh

Thanks so much again for all yours effort.

Best regards.

Salud y Revolución.

Lobo.
--
Libertad es poder elegir en cualquier momento. Ahora yo elijo GNU/Linux,
para no atar mis manos con las cadenas del soft propietario.
---------
Desde El Ejido, en Almería, usuario registrado Linux #294013
http://www.counter.li.org


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user