Matlab program to generate Sinusoidal Sequence/Signal in discrete and continuous form.
Matlab code
clc;
clear all; close all;
A=input('Enter the Amplitude of Sinewave=');
f=input('Enter the Frequency of Sinewave=');
n=input('Enter the Number of Cycle=');
Theta=input('Enter the Phase of Sinewave='); t=0:.01:n/f;
f=input('Enter the Frequency of Sinewave=');
n=input('Enter the Number of Cycle=');
Theta=input('Enter the Phase of Sinewave='); t=0:.01:n/f;
x=A*sin(2*pi*f*t+Theta); subplot(2,1,1);
plot(t,x);
axis([0 n/f -(A+.5) (A+.5)]);
title('Graph for Sinusoidal Sequence [Continuous form]'); xlabel('Time->');
ylabel('x(t)');
subplot(2,1,2);
stem(t,x);
axis([0 n/f -(A+.5) (A+.5)]);
title('Graph for Sinusoidal Sequence [Discrete form]'); xlabel('Time->');
No comments:
Post a Comment