I just to confirm my syntax of abs and mode
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti

I have wrote it like this
x(mod(n, 2) == 0) = 5 * alpha .^ (abs(n(mod(n, 2) == 0))/2);
Is this one is right?
0 Commenti
Risposte (1)
Walter Roberson
il 19 Mag 2023
Not exactly.
syms alpha
n = [1 2 3 4 5]
x(mod(n, 2) == 0) = 5 * alpha .^ (abs(n(mod(n, 2) == 0))/2)
length(n)
length(x)
5 Commenti
Walter Roberson
il 19 Mag 2023
By the way (hint):
[false false true false] .* [1 2 3 4]
Torsten
il 20 Mag 2023
n negative or 0 is not a problem for Zamer's code, as there is no indexing by n
I meant accessing the values of the sequence for n <= 0. The most natural way would be x(n) what does not work.
Vedere anche
Categorie
Scopri di più su Number Theory in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

