clc;clear all;close all;
% Load this in octave, comment out in MATLAB.
pkg load signal;
fs=1000;
t=0:1/fs:1-1/fs;
x=11*sin(2*pi*5*t)+7;
[X,f]=pwelch(x,fs,0,fs,fs);
figure;plot(f,X,'LineWidth',1.3);xlim([0 7])
xlabel('f');ylabel('V^2/Hz');title('PSD');