フィルターのクリア

When i try to create function error "Unable to perform assignment because the left and right sides have a different number of elements." comes up

1 回表示 (過去 30 日間)
I want to create x3=e^(j(1/2)n) for 2<=n<=22
The code i used was:
n=-25:25
x3=zeros(1,length(n))
x3(n>=2 & n<=22)=exp(j*(0.5)).^n
but i got the error in the definition, what can be the solution?

採用された回答

Alan Stevens
Alan Stevens 2021 年 2 月 23 日
Try
n=-25:25;
x3=zeros(1,length(n));
x3(n>=2 & n<=22)=exp(j*(0.5)).^(2:22);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by