STIMULATION OF SIGNALS USING MATLAB Program 2

PROGRAM 2:
OBJECT: To generate a sinusoidal sequence with frequency of 4/20 Hz and plot 80 samples (where sampling frequency is 1Hz). Assuming phase and amplitude to be entered by the user.

SOURCE CODE:
sample=80;
frequency=4/20;
amp=input('Enter the amplitude:');
phase=input('Enter the phase in degree:');
n=0:1:(sample-1);
y=amp*sin(2*pi*frequency*n + phase);
/* PI IS A FUNCTION GIVING VALUE 3.14*/
stem(n,y);
xlabel('n');
ylabel('A M P L I T U D E ');
title('S A M P L E D S I N E W A V E ASSIGN_1.2');

OUTPUT GRAPH:
Enter the amplitude:5
Enter the phase in degree:30
Generate a sinusoidal sequence with frequency of 4/20 Hz and plot 80 samples

Comments/disqusion
No comments