Plot time versus Amplitude for an initial Amplitude of 175, a sampling frequency
ID: 644557 • Letter: P
Question
Plot time versus Amplitude for an initial Amplitude of 175, a sampling frequency (fs) of 512 Hz, a sin wave frequency (fo) of 4 Hz, and phase of 75 degrees. Show damping values of k=0.0 k=0.4, k=0.7 and k=0.9.
Note: You can use Excel, or any other graphing package to perform the calculation and create the plot. You should include all 4 data sets on the same plot. The plot should include x and y axis labels, a title and a legend. The plot should contain at least 5 seconds of data sampled at 512 Hz (2560 points).
Explanation / Answer
Fs = 512;
t = 0:0.4:1000;//change values to plot k=0.7, 0.9
A = 175;
f0 = 4;
data = A*sin(2*pi*f0*t);
N = length(data);
Y(1)=0;
Y = fft(data);
freq = 0:Fs/N:Fs/2-Fs/N;
freq = freq';
amplitude = abs(Y(1:floor(N/2)))/floor(N/2);
subplot(211)
plot(t, data)
xlabel('Time [s]')
ylabel('Amplitude')
title('Time domain signal')
grid on