📄 p1_2.m
字号:
% 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -