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]);

 Respuesta aceptada

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 27 de Nov. de 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

1 comentario

Tianchu Lu
Tianchu Lu el 27 de Nov. de 2020
yeah thanks,would you know what type of signal this is? after its gone through some kinda of filter?

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2020b

Preguntada:

el 27 de Nov. de 2020

Comentada:

el 27 de Nov. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by