How can i create a sequence?
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
Hello,
i want to create a sequence {xn} , xn ∈ {(±1, ±j)} .I want to create this sequence for n=1 to N=100 .How can i create this in matlab code?
thank you.
7 commentaires
KALYAN ACHARJYA
le 2 Nov 2019
Modifié(e) : KALYAN ACHARJYA
le 2 Nov 2019
Can you elaborate more? Is the output xn as cell array or ???
Expected result look like???
John D'Errico
le 2 Nov 2019
Far too little information here.
Are these complex numbers? Are they random, or ar they in some specific order?
As far as creating them, this is just a vector if they are to be complex numbers, or it is an nx2 array. In either case, the answer is trivial, or it should be. But only you have any idea of what you want.
Gn Gnk
le 2 Nov 2019
Adam Danz
le 2 Nov 2019
Some programs such as Python use j as the imaginary unit (Matlab uses i). Could it be that (±1, ±j) represents an imaginary number?
Gn Gnk
le 2 Nov 2019
That helps but the problem is still not defined well enough to offer a definite solution.
xn ∈ {(±1, ±i)} means xn is an element of the set [-1-i, -1+i, 1-i, 1+i].
I don't know how n or N come into play, though.
Here's an idea I'm pulling out of thin air:
% Create a column vector n:N +/- [1 +/-i]
n = 1;
N = 100;
xn = reshape((n:N)' + [-1-i, -1+i, 1-i, 1+i],[],1);
*This uses implicit expansion which requires Matlab r2016b or later.
Gn Gnk
le 2 Nov 2019
Réponses (0)
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!