DSPRelated.com
Forums

xcorr and saving waveform

Started by john1985 December 4, 2007
Hi,
I’m relatively new to matlab and I have a fairly basic 
question. I have 2 waveforms (x1,y1) and (x2,x2). I want 
to give these waveforms names such as wave_1 and wave_2 so 
that I can perform the xcorr function as follows xcorr
(wave_1, wave_2). How would I achieve this in Matlab?
thanks for any help
john
On Dec 4, 7:05 am, "john1985" <murray_1...@hotmail.com> wrote:
> Hi, > I'm relatively new to matlab and I have a fairly basic > question. I have 2 waveforms (x1,y1) and (x2,x2). I want > to give these waveforms names such as wave_1 and wave_2 so > that I can perform the xcorr function as follows xcorr > (wave_1, wave_2). How would I achieve this in Matlab? > thanks for any help > john
John, I know Matlab, and I've used xcorr, but I don't understand your post. What do you mean by "I have 2 waveforms (x1,y1) and (x2,x2)"?
>On Dec 4, 7:05 am, "john1985" <murray_1...@hotmail.com> wrote: >> Hi, >> I'm relatively new to matlab and I have a fairly basic >> question. I have 2 waveforms (x1,y1) and (x2,x2). I want >> to give these waveforms names such as wave_1 and wave_2 so >> that I can perform the xcorr function as follows xcorr >> (wave_1, wave_2). How would I achieve this in Matlab? >> thanks for any help >> john > >John, > >I know Matlab, and I've used xcorr, but I don't understand your post. >What do you mean by "I have 2 waveforms (x1,y1) and (x2,x2)"? >
Darol, I mean that I'm reading 2 waveforms from an oscilloscope where x represents the time base and y1 represents the voltage base. Rgards John
On Dec 5, 8:01 am, "john1985" <murray_1...@hotmail.com> wrote:
> >On Dec 4, 7:05 am, "john1985" <murray_1...@hotmail.com> wrote: > >> Hi, > >> I'm relatively new to matlab and I have a fairly basic > >> question. I have 2 waveforms (x1,y1) and (x2,x2). I want > >> to give these waveforms names such as wave_1 and wave_2 so > >> that I can perform the xcorr function as follows xcorr > >> (wave_1, wave_2). How would I achieve this in Matlab? > >> thanks for any help > >> john > > >John, > > >I know Matlab, and I've used xcorr, but I don't understand your post. > >What do you mean by "I have 2 waveforms (x1,y1) and (x2,x2)"? > > Darol, > I mean that I'm reading 2 waveforms from an oscilloscope where x > represents the time base and y1 represents the voltage base. > Rgards > John
Ok, then I'll assume that you have two waveform files stored somewhere. In Matlab you can create the waveform matrices, for example, like this: freadid1 = fopen('c:/path/waveform1.bin','r'); freadid2 = fopen('c:/path/waveform2.bin','r'); wave_1 = fread(freadid1,'int16',1); % the '1' is used to skip the time data so that you just have the amplitude samples wave_2 = fread(freadid2,'int16',1); corr_result = xcorr(wave_1,wave_2); The Matlab help documentation will give you the wide variety of file I/ O operations that are available. I've just given an example. I suspect that there may be header info in the file that you will have to account for.