Success!
It took a few minutes to get the data out of the figure, and then some experimenting. I thought about low-pass filtering your signal (I still believe that would be a good idea if you intend to repeat this experiment), but decided in the interests of time to go with simple thresholding (while I watched Manchester City and West Ham).
I include all the code, including that to acquire the data from your .fig file (even though you don’t need that part).
The code:
ssf = openfig('sound_speed.fig')
hf2 = get(gca, 'Children')
hf3xc = get(hf2, 'XData')
hf3yc = get(hf2, 'YData')
hf3xd = cell2mat(hf3xc);
hf3yd = cell2mat(hf3yc);
trshld = -0.6;
pulse1 = find(hf3yd(1,:) < trshld);
pulse2 = find(hf3yd(2,:) < trshld);
Fs = 4000;
pl1 = length(pulse1);
pl2 = length(pulse2);
vlen = min(pl1, pl2);
pulsx = pulse1(1:vlen);
pulsy = pulse2(1:vlen);
pulsxt = pulsx/Fs;
pulsyt = pulsy/Fs;
PulsDs = pulsx - pulsy;
PulsDt = pulsxt - pulsyt;
PulsDsM = mean(abs(PulsDs));
PulsDtM = mean(abs(PulsDt));
MicDist = 1.66;
Csc = MicDist/PulsDtM
fprintf(1,'\n\n\tSpeed of sound = %.3f m/s\n\n', Csc)
The result:
Speed of sound = 390.588 m/s
If you intend to repeat this experiment over time, I suggest:
- Develop an appropriate low-pass filter
- Develop an adaptive threshold or other peak- or pulse-detection algorithm
- Record everything that can affect the air density and therefore the speed of sound (temperature °K, barometric pressure, relative humidity, etc.)
- Collect data over time and do regressions (and plots if the function space permits) of the various variables and how they affect the speed of sound over time
- This sounds like a cool advanced secondary or undergraduate university physics experiment!
Best Answer