How can I separate measurement data at different frequencies?

hi,
I have measured strain at different stresses (50 V, 150 V, 250 V, 500 V, 1000 V) and frequencies(0.5 Hz, 1 Hz, 10 Hz, 100 Hz, 200 Hz). Moreover I have the data of these stresses (sinus-curves with 10 cycles) at the different frequencies along measurement time.
How can I separate the areas of different frequencies, to plot stresses over strain?
The plot of different stresses at different frequencies looks like: after a short time (start of the program) it starts with a sinus-curve with the first frequency 0.5 Hz and amplitude 50 V, then it takes a break of a few seconds, and after that starts with second frequency 150 V at the same amplitude, and so on, until it starts with next amplitude 150 V for again all frequencies.

5 Comments

how do you want, exactly separate your data
Does it continue to record the signal during the "break" time, so that you have zero signal between the sine waves, or does the recording pause during the break time so that the sine waves are immediately adjacent to each other?
I don't understand the last sentence. It seems to contradict the first sentence. Are your amplitudes for the 1, 10, 100, and 200 Hz sine waves all 150 Volts (like the last sentence says), or are they 150 V, 250 V, 500 V, 1000 V like the first sentence says?
i think hi made an error when he said 150v (he meant 50v) with all frequencies, then the same is reproduced for 150V, 250V,...
Oh, so it's every possible combination? Could be. I thought it was that they were paired up 50V @ 0.5 Hz, 150V @ 1 Hz, 250 V at 10 Hz, and so on. I wonder if we'll ever hear from mel again, or are we just wasting our time?

Sign in to comment.

Answers (3)

A diagram or plot would sure help. It actually sounds very trivial if you have the Image Processing Toolbox. Do you have that? Just use thresholding, labeling, and regionprops to identify the quiet or still sections that divide your sine waves, then split it up.
Or you could use find:
startingElement = find(signal>=someVoltageValue, 1, 'first');
lastElement = find(signal>=someVoltageValue, 1, 'last');
to find the first and last place where a certain voltage happens. Though with that, you have to make sure you go down from the peak to the baseline to make sure you get the whole half-cycle of the sine wave and not just start at the peak.
If you can supply a vector of values with the different signal values, I could demonstrate.

5 Comments

Hi, how can i take my plot here?
Try uploading a picture to tinypic.com, or see here http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers But I'd rather have you answer my other two questions, about whether you can supply actual data, like a vector of numbers, or if you have the Image Processing Toolbox so we can do it the easy way.
is your sample time fixed? if yes what is it? are your amplitudes and frequency known?
That's what I wondered at first but then I saw that she had exactly 10 cycles for each sample at a particular frequency. Since the sine waves are different frequencies (periods), the sample times for each of the five 10-cycle samples will all be different. However I would think that the sample rate would be the same.
For example, if the sample rate is 1 Khz, 10 cycles of a 0.5 hz signal would be 20 seconds for that sample and at 1000 samples per second, that would be 20,000 samples for the 0.5 Hz sample.
Ten cycles of the 200 Hz would be 10*(1/200) seconds or 0.05 seconds for that sample. Then multiply by 1000 samples /sec and you get 50 samples for the 200 Hz sample.
Hi, i have the image processing toolboox. to supply a vector is very difficult, because i measured all 0.0002 seconds, so that are a lot of data.
but i try to explain better: first data show sine wave with amplitude 50V and frequency of 0.5Hz for 10 cycles(takes 20seconds), then comes the break of a few seconds(so u can see at plot what time starts the next one), the next sine wave with amplitude 50V but a frequency of 1Hz(takes 10seconds), same break, amplitude 50V and Frequency 10Hz(takes 1second), break, amplitude 50V and frequency 100Hz(0.1second), break, amplitude 50V and frequency 200Hz(0.5seconds), break now i change the amplitude to 150V: next is amplitude 150V and frequency 0,5HZ, break, amplitude 150V and frequency 1Hz, break, amplitude 150V and frequency 10Hz, break, amplitude 150V and frequency 100Hz, break, amplitude 150V and frequency 200HZ; and so on and now i need for all this data everytime that area of one frequency at one amplitude separatly the problem is i don't have a smooth signal, so i have a lot of peaks, and after smoothing there is not only one point with highest value, so i cant't find my peak with the findpeak function i tried a lot, now i think the only which help is that matlab can see the different frequency areas, so that i can get them

Sign in to comment.

what i suggest is to do some part of the job manualy
load HV_Piezo1;
y=HV_Piezo1;x=HV_Piezo1_x;plot(y);
[k1,h1]=ginput % will wait that you click on the graph
% click at every end of your part of signal; in this case:click 16 times
% when you have finished selection click: <return>
k0=1
for k=1:length(k1)
figure;plot(x(k0:k1(k)),y(k0:k1(k)))
k0=k1(k)
end
note: your figure must be big to ease your selection

13 Comments

It's hard to tell - do you have 10 cycles in each section? And I don't see any "break" time between sections. Remember he said " it take a break of a few seconds" between sections. It would be nice if he just posted or uploaded some data.
i made a few sample of break, for the cycles you are right, i made 3, did'nt see correctly the question; i will fix it
Hi, this picture above looks like what i have in one data set. so i have to separate every frequency area, i need every sine wave separatly. Here are 10 waves
i generated a signal like you discribed it .you run the code , and you will get separated signals
it sounds good but my waves have an offset of halph of amplitude, so they are not under zero but my break has value zero(its like u turn up ur wavesfor halph amplitude); so what u do with e, g, h exactly? How can i change it for my waves
why don't you post your data using hyperlink. the example i ve used is just to test a code.
  1. e is the indices of all your max and min values
  2. g is the indices for min and max corresponding to one of your amplitudes u(k)
  3. h is indices of the first min max amplitude of each frequency
and just use the second part of a code, the first i did it just to have an example. just assign your signal to yy and run a code below
d=diff(yy)
c=[1 d].*[d 1]
e=find(c<0)
for k=1:5
amplitude=u(k)
c=[1 d].*[d 1]
e=find(c<0)
g=find(abs(abs(yy(e))-amplitude)<amplitude/10);
h=[ 1 find(diff(g)>2) length(g)];
figure
for k=1:5
subplot(3,2,k);plot(t(e(g(h(k))):e(g(h(k+1)))),yy(e(g(h(k))):e(g(h(k+1)))))
end
end
Hi here is the link for my plot: <http://img822.imageshack.us/img822/9011/plott.jpg> i tried ur code with my data, but i don't get meaningful results
your link does'nt work and u did'nt give enough elements to help you
hi, sorry i do something wrong before.
data(x,y values) uploadside for the other plot is http://www.filehosting.at/file/details/367962/HV_Piezo1.mat
direkt downloadlink (u can use one time):http://www.filehosting.at/file/details/367962/QP5gKMa6GAIxffVb/HV_Piezo1.mat i hope it works now
moreover i have to tell, that this plot and data set includes only frequencies of 0.5, 1, 10, 100 Hz.
Those don't look like 10 cycles in each sine wave burst. Plus, each group looks like it's 50 element long, so why can't you just do
group1 = signal(1:50);
group2 = signal(51:100);
and so on?
ry the code i ve updated, it allows to select manualy the different point of your signals (the end points )
Hi, but how i get the data(x,y values) of each area now? And how i can delete the data before my wave starts i need something like that http://imageshack.us/photo/my-images/266/plot2s.jpg/ and the data(x,y) for what is shown. the problem is, i don't know the exact starting time, so with time the plots delay
i write now that code for first 4 waves where i try to find end of every wave and get my starting point for every wave with it:
load('HV_Piezo1.mat')
[pks, loks]=findpeaks(HV_Piezo1,'MINPEAKHEIGHT', 100,'NPEAKS',1);
n=Funktionsgenerator_x(loks);
a=[18/0.0002, 33.5/0.0002, 39.95/0.0002, 45.095/0.0002];
h=[2/0.0002, 1/0.0002, 2/20/0.0002, 2/200/0.0002];
g=[20/0.0002, 10/0.0002, 1/0.0002, 0.1/0.0002]
j=0;
v=[20, 10, 1, 0.1];
for i=1:4
for e=loks+a(i):loks+a(i)+h(i)
j=j+1;
f(j)=HV_Piezo1(e);
end
c=find(f==0);
l(i)=c(1)+loks+a(i)-1
y(i)=HV_Piezo1(l(i));
x(i)=HV_Piezo1_x(l(i));
j=0;
w(i)=a(i)
u(i)=l(i)- g(i)
for o=u(i):l(i)
j=j+1;
d(j,i)=HV_Piezo1(o,1);
b(j,i)=HV_Piezo1_x(o,1);
count(i)=j;
end
j=0;
end
but at i=4 i get that error:Attempted to access HV_Piezo1(247194); index must be a positive integer or logical. Error in sepa3 (line 17) f(j)=HV_Piezo1(e);
i don't understand it, perhaps u can help, thanks a lot

Sign in to comment.

clear
load HV_Piezo1;
y=HV_Piezo1;x=HV_Piezo1_x;plot(y);
close;plot(y)
test=1,
for k=1:16
test=1
while test==1
pause
[k1,h1]=ginput
choice=questdlg('choose between undo and continue','undo choice','continue','undo','undo')
switch choice
case 'continue'
test=0;
case 'repeat'
test=1;
end
end
k1=int64(k1);
z{k}=[x(k1(1):k1(2)) y(k1(1):k1(2))];
end
for k=1:16
xy=z{k};
x=xy(:,1);y=xy(:,2);
figure;plot(x,y);
end
  1. zoom one part of your signal
  2. click any key, because the code is paused
  3. select the start point and the end then click "return"
  4. now the code is again paused. undo zoom and zoom the next wave. and repeat from 1
  5. i 've added a test in case u want repeat one operationnote: don't click any key before zooming your wave, because you will not be able to do it if "[k1,h1]=ginput" is executed

2 Comments

Hi, thanks a lot, i changed it little bit, so that i get all x and y values for every area and i get also data for the other measurements i do at same time.
I still have one question: i have a lot of measurements like that(different piezos and temperature), is there any possibility that matlab see the different frequency areas itself, so that i can write only one script for every separate measurement. Now i have to click my areas for every meassurement myself.
i tried to do it, but i found it difficult , because your signals are not real sinusoides, because of noises.

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

mel
on 18 Aug 2012

Community Treasure Hunt

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

Start Hunting!