Error: Matrix dimensions must agree !

1 visualizzazione (ultimi 30 giorni)
Susan
Susan il 25 Lug 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 :)

Risposta accettata

Paulo Silva
Paulo Silva il 26 Lug 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))

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by