How to fill a 1024 point array with two cycles of a cosine wave?

3 vues (au cours des 30 derniers jours)
Kennard Ng
Kennard Ng le 11 Fév 2019
Commenté : Kennard Ng le 11 Fév 2019
How to fill a 1024 point array with two cycles of a cosine wave?

Réponse acceptée

Luna
Luna le 11 Fév 2019
You can use linspace.
Example:
xData = linspace(0,4*pi,1024);
yData = cos(xData);
figure;
plot(xData,yData);

Plus de réponses (1)

Guillaume
Guillaume le 11 Fév 2019
Knowing that the cycle length of a cosine wave is , what is the length of two cycles?
Once you know that, use linspace to generate a vector of 1024 points between 0 and that length. Pass that vector to cos and you're done.

Catégories

En savoir plus sur Language Fundamentals dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by