Matlab Error using .*. Matrix dimensions must agree

1 回表示 (過去 30 日間)
bribee
bribee 2017 年 6 月 8 日
コメント済み: bribee 2017 年 6 月 8 日
Hello! I am trying to run this code but I keep getting error.
time_res = 1e-2;
T = 15;
t_lim = -T:T;
N = 40;
k = -N:N;
w0 = 2*pi/T;
tp = -T/2:time_res:T/2;
xp = tp.^3;
Basis = exp(1i * w0 * k.' * tp);
Ck = (1/T) * int(xp * (exp(-1i * w0 *k * tp)), tp, -T, T);
t = t_lim;
x = Ck * Basis;
error for this line
Ck = (1/T) * int(xp * (exp(-1i * w0 *k * tp)), tp, -T, T);
Whats wrong?

回答 (1 件)

James Tursa
James Tursa 2017 年 6 月 8 日
k is a vector and tp is a vector. They are not the same size. So you need to revisit this calculation to see what you really want:
xp * (exp(-1i * w0 *k * tp))
  1 件のコメント
bribee
bribee 2017 年 6 月 8 日
I try putting '.' like I did for Basis variable, but it is still not working.

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

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by