p1_2.m

来自「Digital Signal Processing-A Computer-Bas」· M 代码 · 共 20 行

M
20
字号
% Program P1_2.m
% Generation of a sinusoidal sequence
clear all;close all
n = 0:49;   
f = 0.05;
N = 1/f;     %Calculate the period of this sequence
n1 = 1:N;
phase = pi/2;          
A = 2.5;            
arg = 2*pi*f*n - phase; 
x = A*cos(arg);
ap = sum(abs(x(n1)).^2)/N;     %Calculate the average power of the sequence
stem(n,x);      % Plot the generated sequence
axis([0 49 -3 3]);
grid; 
title('Sinusoidal Sequence');
xlabel('Time index n');
ylabel('Amplitude');
axis;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?