Error: Matrix dimensions must agree !

1 visualización (últimos 30 días)
Susan
Susan el 25 de Jul. de 2011
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 :)

Respuesta aceptada

Paulo Silva
Paulo Silva el 26 de Jul. de 2011
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))

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by