185k views
0 votes
Write a program, in MATLAB, that will have the user input the frequencies of 3 sine-waves f1,f2 and .f3 corresponding to V1(t)=10sin(2πf1t), V2(t)=6sin(2πf2t) and V3(t)=4sin(2πf3t) and then produce the sum of the three sine-waves: VT(t)=V1(t)+V2(t)+V3(t) Use the subplot feature of MATLAB to split the screen in two windows, use subplot (2,1, nd then plot the V1,V2 and V3 waveforms on the top window and the resultant waveform on the lower window. (Draw the x-axis for the second graph) .

(a) Run the program for f1=20 Hz,f2=25 Hz and f3=50 Hz with t varying between 0≤t⩽0.5sec. Make a hard copy of the graph and verify that the rule, stated above, is satisfied. Identify the period of the resultant waveform and show your work on the print-out

1 Answer

4 votes

Final answer:

To write a program in MATLAB that produces the sum of three sine waves, use the provided code and input the frequencies of the waves. The program then plots the separate waveforms on one window and the sum waveform on another window.

Step-by-step explanation:

To write a program in MATLAB that will produce the sum of three sine waves, you can use the following code:

f1 = input('Enter frequency of first sine wave: ');
f2 = input('Enter frequency of second sine wave: ');
f3 = input('Enter frequency of third sine wave: ');
t = 0:0.001:0.5;
V1 = 10*sin(2*pi*f1*t);
V2 = 6*sin(2*pi*f2*t);
V3 = 4*sin(2*pi*f3*t);
VT = V1 + V2 + V3;
subplot(2,1,1);
plot(t, V1, t, V2, t, V3);
title('V1(t), V2(t), and V3(t)');
subplot(2,1,2);
plot(t, VT);
title('VT(t) = V1(t) + V2(t) + V3(t)');

User Edson
by
8.1k points