Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Extraction of a wavelegth of the signal
- [y,Fs]=audioread('s1Insaf.wav'); %read the required audio file
- ts=1/Fs;
- figure(1);plot (y);title('The full audio signal');
- y2=y(39000:40000); %manually extract a part of the audio file
- y3=y2/max(y2);
- figure(2);plot (y3);title('The extracted Audio signal');
- x=y2(132:459); %select start point and end points of one wavelength
- figure(3);plot(x);title('One wavelength');
- %Anlysing the signal
- Ns=length(x); % the no. of samples per wavelength
- T=(Ns-1)*ts;
- f0=1/T;
- xa=abs(x);
- Xa_avg=(0.5*(xa(1)+xa(Ns))+sum(xa(2:Ns-1)))/(Ns-1);
- x2=x.^2;
- X_rms=sqrt((0.5*(x2(1)+x2(Ns))+sum(x2(2:Ns-1)))/(Ns-1));
- X_peak=max(xa);
- X_range=max(x)-min(x);
- C=X_peak/X_rms; % crest factor
- PAPR=10*log10(C^2); % PAPR
- Kf=X_rms/Xa_avg; %
- t=0:ts:T;
- j=sqrt(-1);
- Vh=[];
- Ph=[];
- for h=1:10
- e=x.*exp((-j)*2*pi*h*f0*t');
- eint=2*(0.5*(e(1)+e(Ns))+sum(e(2:Ns-1)))/(Ns-1);
- Vh=[Vh,abs(eint)];
- Ph=[Ph,angle(eint)];
- end
- Vh=Vh./max(Vh); %normalizing the amplitudes.
- % Representation of phase plot and magnitude plot.
- figure(4);stem(Vh);title('Magnitude plot');
- figure(5);stem(Ph);title('Phase plot');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement