How to vectorize sum of scaled matrices ? Or is there matlab function for irregular inverse dft ?

2 ビュー (過去 30 日間)
I am trying to inverse transform function on irregular grid. Is there matlab function for irregular inverse dft ?
I would like simplify a code with sum of repeating matrix M multiplied and to the power of vector elements:
X = ones(10,10) % just for simplicity matrix
Y = rand(10,10) % another matrix
M1 = exp(1i*X);
M2 = exp(1i*Y);
v1 = [1, 2, 3, 13, 14]; % some vector
v2 = [10, 20, 13, 33, 44]; % some vector same length
f = [3, 5, 7, 9, 11]; % another vector same length
A = zeros(10,10); %initialize the sum
for ii = 1: length(v)
S = f(ii)*(exp(1i*(Y*v1(ii) + X*v2(ii))));
A = S +A;
end
A
Could repmat or some other function create vectorized version of the code to get the sum?

採用された回答

Andrei Bobrov
Andrei Bobrov 2015 年 3 月 13 日
編集済み: Andrei Bobrov 2015 年 3 月 13 日
A = reshape(exp(1i*[X(:),Y(:)]*[v2;v1])*f(:),size(X));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by