Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
i have been given project of spectrum analysis but i m new in matlab.....
n i want that code which is not 4 any specific 4m any frez it will b generalized one .......
i will b very thankful 2 u !!!
%
% The spectrum of a process x is estimated using Welch's method
% of averaging modified periodograms.
%
% x : input sequence
% L : section length
% over: amount of overlap, where 0<over<1,
% win : The window type
% 1 = Rectangular
% 2 = Hamming
% 3 = Hanning
% 4 = Bartlett
% 5 = Blackman
%
% Welch's estimate of the power spectrum is returned in Px
% using a linear scale.
%
% see also BART, MPER, PER, and SPER
%
if (nargin <= 3) win=1; end;
if (nargin <= 2) over=0; end;
if (nargin == 1) L=length(x); end
if (over >= 1) | (over < 0)
error('Overlap is invalid'), end
n1 = 1;
n2 = L;
n0 = (1-over)*L;
nsect=1+floor((length(x)-L)/(n0));
Px=0;
for i=1:nsect
Px = Px + mper(x,win,n1,n2)/nsect;
n1 = n1 + n0;
n2 = n2 + n0;
end;
auxiliar function:
function Px = mper(x,win,n1,n2)
%MPER Spectrum estimation using the modified periodogram.
%----
%USAGE Px = mper(x,win,n1,n2)
%
% The spectrum of a process x is estimated using the modified
% periodogrm.
%
% x : input sequence
% n1 : starting index, x(n1)
% n2 : ending index, x(n2)
% win : The window type
% 1 = Rectangular
% 2 = Hamming
% 3 = Hanning
% 4 = Bartlett
% 5 = Blackman
%
% If n1 and n2 are not specified the periodogram of the entire
% sequence is computed.
%
% The modified periodogram is returned in Px using a linear scale.
%
% see also BART, PER, SPER, and WELCH
%
x = x);
if nargin == 2
n1 = 1; n2 = length(x); end;
N = n2 - n1 +1;
w = ones(N,1);
if (win == 2) w = hamming(N);
elseif (win == 3) w = hanning(N);
elseif (win == 4) w = bartlett(N);
elseif (win == 5) w = blackman(N);
end;
U = norm(w)^2/N;
xw = x(n1:n2).*w;
Px = abs(fft(xw,1024)).^2/(N*U);
Px(1)=Px(2);
end;
thxxxx 4 the code but i dun want any code of welch n........???simply i wannit to learn how to make spectum analysis through matlab.and how dats works.....i will b very thankful 2 u !!!
pwelch is the matlab command to use. If you read the documentation for pwelch, you will learn how to do spectrum analysis in matlab. You can thank me later.
thank u everone !!!
but i have told that i have been given project to make spectrum analysis!!!
is it feasible to make thorugh software??
or if i have to make through with harware then how can i make it!!!
please tell me !!!
i will b very thankful to u !!!
nyvz thxxxxx alot once again 4 ur cooperation ....
hello everybody !!
still i m in fix to do dat !!!
do u knoe any link from where i get any information regarding spectrum analysis ....is it feasible to make it through software??
Several posters have told you how to do it in software. It's certainly possible to do in matlab. What data are you trying to do a spectrum analysis on?
i have tried to run that principal program by dave but it ain't working.....if u have ryt code of spectrum analysis den plzz provide me m facing problem in it!!!i juz want code in matlab dats it!!!
i want code of spectrum analysis in matlab .....simply whatever u or i will speak i can see the frequency spectrum of that voices on dat .......analyser so if u will help me .......
Hi munaim, RFDave has made a good point: you need to ask your question more clearly. The phrase "spectrum analysis" applies to a wide variety of physics and engineering projects.
You mentioned speech. Do you want to speak into a microphone, and use MATLAB to display the audio frequency spectrum? If that's correct, do you need an ordinary frequency-amplitude graph, or do you need a spectrogram? Do you need real-time display update?
i want to display output on computer through code of matlab n 3 techniques which u have told me ......i want to use the simplest one ............
simply i write that code and having such interface that when i will speak through mic den it will show frequency spectrum of that ..........
n tells how frequency vary with voice .....
i think so now its clear ....
RF dave and other members of edaboard plzzzzz tell me the code n i have told the whole situation to u in previous post .......so plzzzzz tell me
i will b veryy thankful 2 u !!!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.