I need to add and multiply a vetor
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Given a vector u = (u1 + u2 + ... + un) make a funcition which gives u1*u2+u2*u3+...+un-1*un. Apply it to the vector u = cos(0:pi/20:pi)
1 commentaire
Réponse acceptée
Plus de réponses (1)
Bora Eryilmaz
le 13 Déc 2022
Modifié(e) : Bora Eryilmaz
le 13 Déc 2022
This looks like the dot product of the subvectors u(1:n-1) and u(2:end):
u = cos(0:pi/20:pi); % Create the vector
p = u(1:end-1) * u(2:end)' % Use the dot product.
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!