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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Deniz Bozdogan
am 23 Feb. 2021
Kommentiert: Deniz Bozdogan
am 23 Feb. 2021
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?
0 Kommentare
Akzeptierte Antwort
Alan Stevens
am 23 Feb. 2021
Try
n=-25:25;
x3=zeros(1,length(n));
x3(n>=2 & n<=22)=exp(j*(0.5)).^(2:22);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!