How can I separate measurement data at different frequencies?
Show older comments
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
Azzi Abdelmalek
on 18 Aug 2012
how do you want, exactly separate your data
Image Analyst
on 18 Aug 2012
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?
Image Analyst
on 19 Aug 2012
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?
Azzi Abdelmalek
on 19 Aug 2012
i think hi made an error when he said 150v (he meant 50v) with all frequencies, then the same is reproduced for 150V, 250V,...
Image Analyst
on 19 Aug 2012
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?
Answers (3)
Image Analyst
on 18 Aug 2012
Edited: Image Analyst
on 18 Aug 2012
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
mel
on 18 Aug 2012
Image Analyst
on 18 Aug 2012
Edited: Image Analyst
on 18 Aug 2012
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.
Azzi Abdelmalek
on 18 Aug 2012
Edited: Azzi Abdelmalek
on 18 Aug 2012
is your sample time fixed? if yes what is it? are your amplitudes and frequency known?
Image Analyst
on 18 Aug 2012
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.
mel
on 19 Aug 2012
Azzi Abdelmalek
on 18 Aug 2012
Edited: Azzi Abdelmalek
on 20 Aug 2012
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
Image Analyst
on 18 Aug 2012
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.
Azzi Abdelmalek
on 18 Aug 2012
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
mel
on 19 Aug 2012
Azzi Abdelmalek
on 19 Aug 2012
Edited: Azzi Abdelmalek
on 19 Aug 2012
i generated a signal like you discribed it .you run the code , and you will get separated signals
mel
on 19 Aug 2012
Azzi Abdelmalek
on 19 Aug 2012
Edited: Azzi Abdelmalek
on 19 Aug 2012
why don't you post your data using hyperlink. the example i ve used is just to test a code.
- e is the indices of all your max and min values
- g is the indices for min and max corresponding to one of your amplitudes u(k)
- 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
mel
on 19 Aug 2012
Azzi Abdelmalek
on 19 Aug 2012
Edited: Azzi Abdelmalek
on 19 Aug 2012
your link does'nt work and u did'nt give enough elements to help you
mel
on 19 Aug 2012
Image Analyst
on 19 Aug 2012
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?
Azzi Abdelmalek
on 19 Aug 2012
ry the code i ve updated, it allows to select manualy the different point of your signals (the end points )
mel
on 20 Aug 2012
Azzi Abdelmalek
on 20 Aug 2012
Edited: Azzi Abdelmalek
on 20 Aug 2012
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
- zoom one part of your signal
- click any key, because the code is paused
- select the start point and the end then click "return"
- now the code is again paused. undo zoom and zoom the next wave. and repeat from 1
- 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
mel
on 22 Aug 2012
Azzi Abdelmalek
on 24 Aug 2012
i tried to do it, but i found it difficult , because your signals are not real sinusoides, because of noises.
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!