MATLAB中FFT分析
首先我把外部的波形导入,进行编辑,总说我错误;第二0.00005秒的数据间隔,我设fs=20000;
还是希望帮我把FFT搞出来,用的是花月先生的代码
[分享] MATLAB中做FFT
https://www.mmc-hvdc.com/t-497.html
2楼给出了详细的代码呀,是不是没有往下看。。。
这数据处理过程是咋样的,应该得先提取需要进行傅里叶变换的数据吧 123 发表于 2020-10-16 09:09
这数据处理过程是咋样的,应该得先提取需要进行傅里叶变换的数据吧
谢谢,我已经解决了 923307293 发表于 2020-10-16 16:27
谢谢,我已经解决了
请问是如何解决的
1inxuetin 发表于 2020-10-19 15:49
请问是如何解决的
close all
Fs = 10000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 5000; % Length of signal
t = (0:L-1)*T*1; % Time vector
S = VarName8;
% Corrupt the signal with zero-mean white noise with a variance of 4.
X = S(1:5000) + 2.*randn(length(t),1);
% Plot the noisy signal in the time domain. It is difficult to identify the frequency components by looking at the signal X(t).
figure(1);
plot(1000*t,X)
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('t (milliseconds)')
ylabel('X(t)')
Y = fft(X);
% Compute the two-sided spectrum P2. Then compute the single-sided spectrum P1 based on P2 and the even-valued signal length L.
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
% Define the frequency domain f and plot the single-sided amplitude spectrum P1.
% The amplitudes are not exactly at 0.7 and 1, as expected, because of the added noise. On average,
% longer signals produce better frequency approximations.
figure(2);
f = Fs*(0:(L/2))/L;
plot(f,P1')
title('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
% Now, take the Fourier transform of the original, uncorrupted signal and retrieve the exact amplitudes, 0.7 and 1.0.
%
Y1 =fft(S);
P21 = abs(Y1/L);
P11 = P2(1:L/2+1);
P11(2:end-1) = 2*P11(2:end-1);
figure(3);
plot(f,P11')
title('Single-Sided Amplitude Spectrum of S(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
这是代码,我之前其实是其他部分有问题,S后面是导入数据删掉第一行标题后的列数据 您好,请问一下外部波形的导入是如何实现的 wanghe 发表于 2021-1-6 22:57
您好,请问一下外部波形的导入是如何实现的
MATLAB主界面上方,主页----导入数据-----点击后右下角有可识别的数据文件---------选择所有文件---------找到所要导入的数据--------出现新界面------选择自己要导入的数据以及输出类型-------导入
页:
[1]