Hi all,
I am struggling to find a way to extract data from a 3D matrix. what I want to achieve is -
every time the 'abs' value of column A - column B = 200 I want to extract the value in both these columns into a new array. This would then give me a new array with all the possibilities, over a defined spectrum, for calculating intermodulation distortion (at the moment this is just the 1st fundamental frequency pairs.
thanks for any help.
freq_spacing = 200;
A = [606000: 200: 614000];
B = [606000: 200: 614000];
min_value = 606;
max_value = 614;
counter = 1;
while min_value < max_value
for Aindex = (1:41)
for Bindex = (1:41)
%first order IMD
onef1 = A(Aindex);
onef2 = B(Bindex);
arr_1st(Aindex,:,Bindex) = [onef1 onef2];
end
end
min_value = min_value + .2;
counter = counter + 1;
end
arr_1st(:,3,:) = abs (arr_1st(:,1,:) - arr_1st(:,2,:));
abs (arr_1st(:,1,:) - arr_1st(:,2,:)) == freq_spacing

回答 (1 件)

dpb
dpb 2018 年 4 月 14 日

0 投票

Try
[A,B]=meshgrid(A,B); % 2D grid of frequency points
ix=(abs(A-B)==200); % logic indexing array of locations 200 (Hz?) different
Select from your arrays for those indices (presuming, of course, the presumption I'm making that the A,B vectors are the same size as the dimensions of the actual data arrays).

2 件のコメント

Mark Healy
Mark Healy 2018 年 4 月 14 日
Thanks for the quick reply, this could be useful but at the moment is not exactly what I require.
To further calculate the 2nd, 3rd, 4th etc intermodulation distortion products i require the actual data of two adjacent frequencies. So the first instance would be 606000 and 606200, these numbers are used for the calculations so I need a way of extracting these numbers to a list.
The current spacing is currently set to 200Hz but the idea is that it can be changed and the code update to accommodate this, eventually allocating frequencies for RF devices with no issues of IMD.
dpb
dpb 2018 年 4 月 14 日
編集済み: dpb 2018 年 4 月 14 日
Where are the data associated with the differences; aren't they in arrays with fixed df grid? It should be no more than a linear relationship from the grid index above to that of that data even if not 1:1.
Or, if it's simply a base frequency and the sidebands of n*df either side like we do for bearing noise analyses where n is some integer or even fractional multiple of a fundamental frequency, it's still just a linear computation of the nearest frequency bin containing the desired...
Or, I'm totally whiffing on the need...always a possibility. :)

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

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

質問済み:

2018 年 4 月 14 日

編集済み:

dpb
2018 年 4 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by