what type of signal is this?FIR filters
2 views (last 30 days)
Show older comments
Tianchu Lu
on 27 Nov 2020
Commented: Tianchu Lu
on 27 Nov 2020
i am confused as to what type of signal this is when the matlab code is written.
here's ,my code, the variables are linked.
input = xx;
T = 2001;
N = length(t);
freq = abs(fft(input))*2/N;
f = (0:N-1)'/T;
subplot(2,2,1);
plot(input, 'b*-'); % Plot the input as a blue line
xlabel('Time/s');
ylabel('Amplitude');
subplot(2,2,2);
plot(f,freq);
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
xlim([0 0.5]);
0 Comments
Accepted Answer
Sulaymon Eshkabilov
on 27 Nov 2020
Here is the corrected code. Time domain vs. Frequency domain analysis of the signal t vs. xx:
load firlab2
%%
input = xx;
dt = t(2)-t(1); % Sampling time, [s]
fs = 1/dt; % Sampling frequency, [Hz]
N = length(t); % Signal length
F = abs(fft(input))/N; % Signal spectrum
F1 = F(1:N/2+1);
F1(2:end-1) = 2*F1(2:end-1);
f = fs*(0:(N/2))/N; % Frequency data
subplot(211)
plot(t, input, 'b-') % Input signal in Time domain
xlabel('\it Time, [s]')
ylabel('\it Amplitude')
title 'Signal in time domain'
grid on
subplot(212)
plot(f,F1) % Input signal spectrum in frequency domain
title('Single-Sided Amplitude Spectrum of Signal ')
xlabel('\it Frequency, [Hz]')
ylabel('\it Amplitude of Spectrum')
grid on
More Answers (0)
See Also
Categories
Find more on Multibody Dynamics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!