multiple sine wave adding and ploting

12 ビュー (過去 30 日間)
Abdirahman  Abdullahi
Abdirahman Abdullahi 2017 年 4 月 29 日
編集済み: Image Analyst 2017 年 4 月 29 日
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 件のコメント
Star Strider
Star Strider 2017 年 4 月 29 日
In the images, the two different frequency sine functions are being multiplied, not added.
You need to clarify this assignment.

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2017 年 4 月 29 日
編集済み: Image Analyst 2017 年 4 月 29 日
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;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by