How do i create a large matrix with a formula?

3 ビュー (過去 30 日間)
Kane OConnor
Kane OConnor 2021 年 5 月 17 日
編集済み: James Tursa 2021 年 5 月 17 日
I want to create a matrix with the pattern below for N = 1000, i.e a 1000 X 2 matrix?

回答 (2 件)

James Tursa
James Tursa 2021 年 5 月 17 日
編集済み: James Tursa 2021 年 5 月 17 日
N = 1000;
a = 2 * pi * f * T * (0:N-1)';
x = [cos(a) -sin(a)];

Paul Hoffrichter
Paul Hoffrichter 2021 年 5 月 17 日
編集済み: Paul Hoffrichter 2021 年 5 月 17 日
Since you did not specify T and f, I assume you wanted symbolic notation. (I picked N = 10 to show a brief output.)
N=10;
n = 0:N-1;
syms T f
vec1 = cos(2*pi*f*n/T).';
vec2 = -sin(2*pi*f*n/T).';
X = [vec1 vec2]
Output (on R2020a):
X =
[ 1, 0]
[ cos((2*pi*f)/T), -sin((2*pi*f)/T)]
[ cos((4*pi*f)/T), -sin((4*pi*f)/T)]
[ cos((6*pi*f)/T), -sin((6*pi*f)/T)]
[ cos((8*pi*f)/T), -sin((8*pi*f)/T)]
[ cos((10*pi*f)/T), -sin((10*pi*f)/T)]
[ cos((12*pi*f)/T), -sin((12*pi*f)/T)]
[ cos((14*pi*f)/T), -sin((14*pi*f)/T)]
[ cos((16*pi*f)/T), -sin((16*pi*f)/T)]
[ cos((18*pi*f)/T), -sin((18*pi*f)/T)]

カテゴリ

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