% This m-file psdchk1.m was created by Professor Ron Adrezin
% of The Cooper Union, School of Engineering
% on 5/04/97. It was last modified on 5/04/97.
% The purpose of this m-file is to demonstrate how to
% determine the frequency of an incoming signal.
% The user will specify up to three functions.
% These functions are summed and their
% resulting function is then plotted and its Power Spectral
% Density (PSD) is calculated and plotted.
% Can you tell the frequencies of the three functions
% by only reviewing the PSD plot? What about the Amplitude
% of each function? Can this be estimated from the PSD plot?
% FunctA: the first function
% A1: amplitude of the first function in meters
% f1: frequency of the first function in Hz
% FunctB: the second function
% A2: amplitude of the second function in meters
% f2: frequency of the second function in Hz
% FunctC: the third function
% A3: amplitude of the third function in meters
% f3: frequency of the third function in Hz
% FunctTotal: the sum of the three functions
% fs: the sampling frequency in Hz
% t: time in seconds
% t0: start time in seconds
% tf: final time in seconds
title('Plot of FunctTotal');
p=spectrum(FunctTotal,512); %This requires at least 1024 points
% It also must be 2 to a power.