MATLAB Answers

how can determine phase from FFT

3 views (last 30 days)
Ass
Ass on 9 Jul 2020
I have written a code, where I have matrix dimension 1801 by 88 and when i am running the code, phase is obtained. But in foor loop the first column of phase is repeatedly coming for other 88 columns. But in amplitude, it is coming properly i.e. 901 by 88. In phase, matrix dimension is 901 by 88 but in which same values are coming repeatedly for all columns. Please help me regarding this.
clc;
clear all;
load data.dat;
time=0:2:3600;
time=time';
nn_ss=data(1:1800,1:88);
for jj=1:88
ss_nw = nn_ss(:,jj);
Ts = mean(diff(time)); % sampling time
Fs=500; %sampling frequency ** It should be 1/Ts
Fn=Fs/2; %Nyquist frequency
L=length(time);
Y=fft(ss_nw);
fts=Y/L; %Normalized fft
P_amp2=abs(Y/L);
P_amp(:,jj) = P_amp2(1:L/2+1);
P_amp(2:end-1,jj) = 2*P_amp(2:end-1,jj);
f=Fs*(0:(L/2))/L;
phase(:,jj)=angle(Y).*180/pi;
phase1(:,jj)=phase(1:L/2+1);
%phase1(:,jj)=phase(1:901,jj);
ly=length(Y);
fs=(-ly/2:ly/2-1)/ly*Fs;
end

  0 Comments

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!