フィルターのクリア

Creating a matrix of sinusoids with time increasing over rows, and frequency + phase increasing stepwise over columns

1 回表示 (過去 30 日間)
I need to create a matrix/array of sinusoids with time vector increasing along rows and frequency vector increasing along columns together with a phase vector. The frequency vector and phase component of the sinusoids each increase stepwise on a logarithmic scale.
Something like this:
t = t1:int:n;
f = logspace(-1,4,100);
p = logspace(-1,pi,100);
y(t, f, p) = sin(2*pi*f*t + p)
The desired result is as follows (column and row headings are added for clarity of the question here):
Y{} =
f1/p1 f2/p2 ... f100/p100
-- --
t1 |sin(2*pi*f1*t1 + p1) sin(2*pi*f2*t1 + p2) ... sin(2*pi*f100*t1 + p100)|
t2 |sin(2*pi*f1*t2 + p1) sin(2*pi*f2*t2 + p2) ... sin(2*pi*f100*t2 + p100)|
...| ... ... ... ... |
tn |sin(2*pi*f1*tn + p1) sin(2*pi*f2*tn + p2) ... sin(2*pi*f100*tn + p100)|
-- --
Help is hugely appreciated, thanks
  2 件のコメント
Star Strider
Star Strider 2014 年 10 月 4 日
What about the answers provided to you in Creating a matrix of sinusoids with frequency increasing over columns and time increasing over rows didn’t work for you after you accepted it and got more than one good answer?
Nate
Nate 2014 年 10 月 4 日
In that previous question there was no phase vector. The answers to my prior question do not work in this setting since they involved simple matrix multiplication. Here I need matrix multiplication + an addition of the phase component.

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

採用された回答

Guillaume
Guillaume 2014 年 10 月 4 日
編集済み: Guillaume 2014 年 10 月 4 日
You would use ndgrid or meshgrid:
t = t1:int:n;
f = logspace(-1,4,100);
p = logspace(-1,pi,100);
[tt, ff] = ndgrid(t, f);
[~, pp] = ndgrid(t, p); %already got tt with first ndgrid
y = sin(2*pi*ff.*tt + pp); % be mindful of the by element multiply .*

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by