Azzera filtri
Azzera filtri

How to do calculations with variables of different size?

2 visualizzazioni (ultimi 30 giorni)
I have two signals- sample and reference, each described by a list of data sets made up of complex number. As I am trying to obtain a optical parameter out of this information, I have to first express a function where it is a ratio of sample over the reference. From there, I had come out with r_mag and r_ang as the magnitude and phase of the ratio respectively. And both r_mag and r_ang are double variables have size of 947 x1. So, I went on to do my calculation for abp_1 and abp_2 as shown in the code below. And that is when I got a size of 947 x 947 for abp_3 as a double. And I encountered an error calculating abp_f. I think it has something to do with the size of the variable. However, I do not know how to resolve this problem. (As I thought the size of abp_3 is going to be 947 x1 as I thought one long list of data multiply with another similar list will produce another similar list.)
abp_1= (4*pi*frequency*(1E12)/(3E8));
abp_2=(2*r_mag*sin(r_ang));
abp_3=(1+(r_mag*r_mag)-(2*r_mag*cos(r_ang)));
abp_f= (abp_1)*((abp_2))/(abp_3);
Can anyone kindly advice me what to do? Any help will be deeply appreciated. Thank you!
  2 Commenti
Rik
Rik il 29 Gen 2018
I suspect that you actually mean element-wise multiplication and division, instead of matrix multiplication and division. If so: replace every '*' with '.*' and every '/' with './'.
Minnie
Minnie il 29 Gen 2018
Hi Rik! It works. Thank you so much!

Accedi per commentare.

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by