what type of signal is this?FIR filters
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Tianchu Lu
il 27 Nov 2020
Commentato: Tianchu Lu
il 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 Commenti
Risposta accettata
Sulaymon Eshkabilov
il 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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Acoustics, Noise and Vibration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!