FFt of X (DATA:901) and y (DATA:901)
조회 수: 2 (최근 30일)
이전 댓글 표시
hallo people pls I need your help. I have a plot of reflectance against wavelength. I need to generate the FFT of this data. I though I need to change my wavelength to frequency unit. but the code belows tells me that error'matrix must have the same length. what can do to solve this problem and how I put my y datain the code? or can someone give a generall code I just put my y and X DATA.
Fs = 150; % Sampling frequency t = 0:1/Fs:1; % Time vector of 1 second f = y; % Create a sine wave of f Hz. x cos(2*pi*t*f); nfft = 901; % Length of FFT X = fft(x,nfft); X = X(1:nfft/2); % Take the magnitude of fft of x mx = abs(X); % Frequency vector f = (0:nfft/2-1)*Fs/nfft; Power Spectrum of a Cosine Wave % Generate the plot, title and labels. figure(1); plot(t,x); title('Sine Wave Signal'); xlabel('Time (s)'); ylabel('Amplitude'); figure(2); plot(f,mx); title('Power Spectrum of a Sine Wave'); xlabel('Frequency (Hz)'); ylabel('Power');
댓글 수: 1
Jordy Jose
2018년 2월 1일
Hi Jean,
It will be great if you could put the code in a code block so that it is more readable. That will make it easier for others to comprehend and respond faster.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!