How to make a waveform and identify the pahse of a signal?

1 回表示 (過去 30 日間)
Maria Amr
Maria Amr 2021 年 6 月 9 日
Hello everyone!
I truly appreciate if someone helps me as I am realy a new MATLAB user. I have a small signal (only two samples)(attached) and I have made the amplitude spectrum and phase but my proffessor said the phase and waveform are wrong. Then, I need to make the waveform and identify the phase in time domain again. I ppreciated your points in advance! My code is below:
clc;
clear all;
close all;
data=xlsread('1');
amp=data(:,2);%us/f
time=data(:,1);%ms
t=time(1:1:end);
am=amp(1:1:end);
l=length(t);
NFFT=l';
S = fft(amp)/NFFT;
P2 = abs(S)*2;
lP2=floor(length(P2));
mS=P2(1:lP2);
freqS=1:lP2;
figure(1)
plot(freqS,P2,'g','LineWidth',2);
ylabel('Amplituse (dB)','FontSize',14);
xlabel('Frequency (Hz)','FontSize',14);
xlim([-inf max(freqS)])
%.........................
PP=phase(S); %Phase Spectrum
figure(2)
plot(freqS,PP,'g'); %Plotting the frequency domain
xlabel('Frequency (Hz)','FontSize',14);
ylabel('Phase','FontSize',14);
%...............
fx=fft(am);
fx(50:350)=0;
X=abs(ifft(fx));
figure(3)
plot(X,'b','Linewidth',2)
xlim([0 100]);
xlabel('Time (ms)','FontSize',14)
ylabel('Amplitude','FontSize',14')
title('Waveform','FontSize',14')

回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by