MATLAB Program for Plotting Two sine waves Connected Together

MATLAB Program for plotting Two sine waves connected together, one of which has twice the frequency of other.

Program

%Two sine waves connected together,one of which has twice the frequency of other
%provided by electricalvoice.com
clc
clear all
fr= input('Enter frequency in Hz:');
stptime = input('Enter Stop time in Second:');
frad = 2*pi*fr;           
t = 0:0.005:stptime;                   
y1 = sin(frad * t);       
plot(t,y1)
hold on
y2 = sin(2 * frad * t);
plot(t,y2)
xlabel('Time (seconds)')          
ylabel('y(t)')

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.