How to make a waveform and identify the pahse of a signal?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Pulsed Waveforms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!