i have an Error using ^

12 ビュー (過去 30 日間)
samuel herrera
samuel herrera 2021 年 4 月 8 日
回答済み: madhan ravi 2021 年 4 月 8 日
can anyone help me fixing this code
n = 0:1:50;
y = (0.3)^(n)*cos(2*pi*0.05)*heaviside(n);
plot(x,y)
Error using ^ (line 51)
Incorrect dimensions for raising a matrix to a power. Check that the matrix is
square and the power is a scalar. To perform elementwise matrix powers, use '.^'.
and if i put the point it shows
n = 0:1:50;
y = (0.3).^(n)*cos(2*pi*0.05)*heaviside(n);
plot(x,y)
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of
columns in the first matrix matches the number of rows in the second matrix. To
perform elementwise multiplication, use '.*'.

採用された回答

madhan ravi
madhan ravi 2021 年 4 月 8 日
Change * to .* in all the places.

その他の回答 (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