Error: Matrix dimensions must agree !

1 次查看(过去 30 天)
I am applying cross correlation to my two signals and the two signals are generated from the same function like sin but with random data generated so I assume some might have more data than other but thats how it should be and part of the calculation is to times both signals and thats the error i get..The question is how can I like create a window frame meaning on applying to the areas where both signals overlap so I would definitely have exact numbers of data and hopefully timing both signals would not be a problem...
Thanks in advance :)

采纳的回答

Paulo Silva
Paulo Silva 2011-7-26
Maybe this can help you
%random data with a random number of columns from 10 to 100
a=rand(1,randi([10 100]));
b=rand(1,randi([10 100]));
%find the maximum index that you can go in your window
mx=min(numel(a),numel(b));
%random start index of the window from 1 to the maximum index of data
in=randi([1 mx]);
n=in:mx-1; %index values inside the selected window
%just for fun plot the data inside the window
cla
plot(n,a(n),n,b(n))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by