Re: Loading and operate multiples files

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Loading and operate multiples files

apjanke-floss


On 3/25/19 4:30 PM, Priscilla wrote:

> Hello!
>
> I have been working on a project involving the Picoscope signal
> (oscilloscope).
> I've made the code below to load the 32 files generated by the Picoscope and
> cut those signals in a specific range (1500 - 5000), and it's working.
>
> But now, I need to do some mathematical operations using these files, like
> calculate the RMS and the area below the graph of the accumulated
> amplitudes. So I made this code:
>
> --------
> clear
> pkg load signal
>
> #Loading the 32 files
> for i = 1:32
>      str= strcat(sprintf("pcb 0_%02d.mat", i));
>            load(str)
>
> #Cut the signal
> Aa = A(1500:5000);
> #Aa=Aa-mean(Aa);
> step=200;
> plot (Aa)
> hold on
>  
> #Convert to RMS
>   Ac=0;
>    i=1;
>
> for index=1:step:(5000-step)
>    Ab(i)=rms(Aa(index:index+step))-mean(Aa(index:index+step));
>    
>   #Accumulate the amplitudes
>   Ac(i+1)=Ac(i)+Ab(i);
>    i=i+1
>    end
> end
> --------
>
> But it is not working...I don't know what is wrong...
>
> Thank you for your help!

Can you give us more details? Are you getting any error messages? What
results did you want, and what is actually happening?

http://www.catb.org/~esr/faqs/smart-questions.html

Cheers,
Andrew


Reply | Threaded
Open this post in threaded view
|

Re: Loading and operate multiples files

Doug Stewart-4


On Mon, Mar 25, 2019 at 6:24 PM Priscilla <[hidden email]> wrote:
Hello!

I have been working on a project involving the Picoscope signal
(oscilloscope).
I've made the code below to load the 32 files generated by the Picoscope and
cut those signals in a specific range (1500 - 5000), and it's working.

But now, I need to do some mathematical operations using these files, like
calculate the RMS and the area below the graph of the accumulated
amplitudes. So I made this code:

--------
clear
pkg load signal

#Loading the 32 files
for i = 1:32
    str= strcat(sprintf("pcb 0_%02d.mat", i));       
          load(str)

#Cut the signal
Aa = A(1500:5000);
#Aa=Aa-mean(Aa);
step=200;
plot (Aa)
hold on       

#Convert to RMS 
 Ac=0;
  i=1;

for index=1:step:(5000-step)
  Ab(i)=rms(Aa(index:index+step))-mean(Aa(index:index+step));

 #Accumulate the amplitudes
 Ac(i+1)=Ac(i)+Ab(i);
  i=i+1
  end
end
--------

But it is not working...I don't know what is wrong...

Thank you for your help!






--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html




First  ---> slowdown  don't post it 3 times!

rms fill work on the full vector at once, not index by index.

--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: Loading and operate multiples files

Doug Stewart-4


On Mon, Mar 25, 2019 at 6:53 PM Priscilla Neves <[hidden email]> wrote:
I'm sorry, I thought the messages had not been sent. My bad.

Em seg, 25 de mar de 2019 às 19:45, Doug Stewart <[hidden email]> escreveu:


On Mon, Mar 25, 2019 at 6:24 PM Priscilla <[hidden email]> wrote:
Hello!

I have been working on a project involving the Picoscope signal
(oscilloscope).
I've made the code below to load the 32 files generated by the Picoscope and
cut those signals in a specific range (1500 - 5000), and it's working.

But now, I need to do some mathematical operations using these files, like
calculate the RMS and the area below the graph of the accumulated
amplitudes. So I made this code:

--------
clear
pkg load signal

#Loading the 32 files
for i = 1:32
    str= strcat(sprintf("pcb 0_%02d.mat", i));       
          load(str)

#Cut the signal
Aa = A(1500:5000);
#Aa=Aa-mean(Aa);
step=200;
plot (Aa)
hold on       

#Convert to RMS 
 Ac=0;
  i=1;

for index=1:step:(5000-step)
  Ab(i)=rms(Aa(index:index+step))-mean(Aa(index:index+step));

 #Accumulate the amplitudes
 Ac(i+1)=Ac(i)+Ab(i);
  i=i+1
  end
end
--------

But it is not working...I don't know what is wrong...

Thank you for your help!




If you want the rms of Aa thendo:

q=rms(Aa)

 


First  ---> slowdown  don't post it 3 times!

rms fill work on the full vector at once, not index by index.

--
DASCertificate for 206392



--
Atenciosamente, 
Priscilla Neves
Engenheira Ambiental 
Mestranda em Saneamento, Meio Ambiente e Recursos Hídricos- UFMG
tel: 55 31 999616346
Paz e Bem!


--
DASCertificate for 206392