How do i define a signal from 2 sets of data or two row vectors?

2 ビュー (過去 30 日間)
Ronan
Ronan 2015 年 1 月 28 日
コメント済み: Jan 2015 年 5 月 15 日
So this seems like a basic question. I have a vector for x values and a vector for y values and i want to use this as a signal/function for the input of the cross correlation function.
The input for the cross correlation function gives examples of sine waves or random signals which isnt what i have. How do i take something like
x = [1,5,10,15,20]; y = [20,30,15,21,18];
and then form a function/signal
s1 = x and y?
Am i taking the wrong approach?
[MOVED from Answer section:]
I m looking to compare two signals using the xcorr function. So one signal has on its x axis 0-360 and the other signal has on its x-axis 0-720. So even though they are of different lengths this doesnt matter because the sampling rates are the same. ie per degree sample. Then for the y axis values its just random data. At first i was comparing the y axis values in the xcorr function but then i realised that the function needs the signals. So i want something like this
x1 = [1:360];
y1 = [data1];
x2 = [1:720];
y2 = [data2];
val = xcorr(s1,s2);
How do i define s1 and s2?
[MOVED from Comment to Answer section] i know i asked this question a while ago, but for people who want to know, i think you can just compare the y values provided the sampling rate of the x value is the same. So if you wanted to correlate the above you just do xcorr(y1,y2). forming a signal s1 and s2 is unnecessary. if x1 is larger than x2 this doesnt matter provided the sampling rate is the same, eg x1 = [1,2,3,4,5] and x2 = [1,2,3,4]. However you would have to interpolate the data if the sampling rate was not the same eg x1 = [1,3,5] and x2 = [1,2,3,4]
  1 件のコメント
Jan
Jan 2015 年 5 月 15 日
Please add all important information in the question. Adding them as an pseudo-answer and a comment to this answer is confusing, because the readers expect all required details in the question. Thanks.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2015 年 1 月 28 日
Perhaps you mean to plot them? Some options include
plot(x,y);
scatter(x,y);
bar(x,y);
What are you planning on correlating that signal with? Does it also have non-uniform x spacing like the signal you gave? If so you'll have to interpolate them to give uniform x spacing.

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by