multiple sine wave adding and ploting

12 visualizaciones (últimos 30 días)
Abdirahman  Abdullahi
Abdirahman Abdullahi el 29 de Abr. de 2017
Editada: Image Analyst el 29 de Abr. de 2017
Hi every body .. i need help.. i was going to answer the following code of my matlab beginner lessons, so i confused as i'm new to the coding .. Actually i would appreciate if some one could help me.. this the question..
Write a function called mix_sines that takes two positive scalar input arguments f1 and f2 (you do not have to check the input arguments) that represent the frequency of two sines waves. The function needs to generate these sines waves, add them together and plot the result. If the function is called like this: mix_sines(1,0) then it displays three full periods of a regular sine wave with amplitude 1. If it is called like this: mix_sines(20,21), then it plots Figure 2.21 below (note that if you add a phase shift of pi to one of the sines, then the result will start at 0 as shown below). Notice that the amplitude is 2. Also, notice that signal has three times 21 periods, but the envelope signal has three times 1 periods. That is because the difference of the two frequencies (21 and 20) is 1. ? Figure 2.20 Problem 8 Figure.. i posted the fig8 below here.
  1 comentario
Star Strider
Star Strider el 29 de Abr. de 2017
In the images, the two different frequency sine functions are being multiplied, not added.
You need to clarify this assignment.

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 29 de Abr. de 2017
Editada: Image Analyst el 29 de Abr. de 2017
Hints: formulas for sine wave
y = sin(2*pi*f*(x-phaseShift));
y = amplitude * sin(2*pi*(x-phaseShift)/period);
and period = 1/f. Compute x using linspace():
x = linspace(0, 3*period, 500); % 500 points between 0 and 3*period
and of course use plot(), and to get even fancier, use title, xlabel, ylabel and grid.
xlabel('X', 'FontSize', 20);
ylabel('Y', 'FontSize', 20);
title('My Awesome Homework Solution', 'FontSize', 20);
grid on;

Más respuestas (0)

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by