Тёмный

Plotting Frequency Spectrum using Matlab 

David Dorran
Подписаться 19 тыс.
Просмотров 320 тыс.
50% 1

Outlines the key points to understanding the matlab code which demonstrates various ways of visualising the frequency content of a signal at dadorran.wordpress.com/2014/02.... This code is published in a more visually friendly way at dadorran.wordpress.com/2014/02...

Опубликовано:

 

27 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 87   
@dragoncurveenthusiast
@dragoncurveenthusiast 6 лет назад
Thank you for this explanation! I already had more background knowledge than was required for this video, but it was still very useful.
@fatihersoy7559
@fatihersoy7559 6 лет назад
ONE OF THE BEST TUTORIALS EVER!!!
@randleonline
@randleonline 9 лет назад
You should be dividing by N in your amplitude spectrum if you want to show the frequency response - also using fftshift will shift your fft as needed IE.. N = length(signal); fs = 2000; n = 0 : N-1; A = 12; f = 100; signal = A*cos(2*pi*100*n/fs); Hf = fftshift( fft(signal,N) ); If you want A/2 as the amplitude value for the pos and negative halves of the spectrum you need to plot like this.. freq = -fs/2 : fs / N : fs/2 - 1/N; plot(freq, abs(Hf) / N);
@ncwolfe
@ncwolfe 8 лет назад
Great explanation. Thanks for making this.
@dhimanbhowmick9558
@dhimanbhowmick9558 8 лет назад
Thanks a lot ,David Dorran,I think it is the best explanation. And Thanks for the types varity you showed.
@franciscoantoniomoralesher2934
Very straightforward explanation!
@andy1shi
@andy1shi 4 года назад
Finally some good explanation!
@Luxedrina
@Luxedrina 3 года назад
Thank you, thank you. You saved my miserable life.
@wakeelmohammed2473
@wakeelmohammed2473 3 года назад
Hey! I just found this is the latest reply for this video. I am doing a vibration analysis project, Would you have any tips or discussions to share with me... thank you
@otsilekgaladua5485
@otsilekgaladua5485 8 лет назад
brilliant explanations as always
@infiniteseekers_
@infiniteseekers_ 9 лет назад
really thank you your videos are really useful for me
@DolamandaS
@DolamandaS 4 года назад
thank you so much for this. makes sense! very helpful
@achilhermawan4529
@achilhermawan4529 4 года назад
It's a perfect tutorial. Thank you, David.
@tristanjaiden3057
@tristanjaiden3057 2 года назад
You probably dont give a damn but does anyone know a way to log back into an instagram account? I was stupid lost the account password. I love any tips you can give me!
@donovanatticus5677
@donovanatticus5677 2 года назад
@Tristan Jaiden Instablaster =)
@tristanjaiden3057
@tristanjaiden3057 2 года назад
@Donovan Atticus thanks for your reply. I got to the site thru google and Im in the hacking process atm. I see it takes quite some time so I will reply here later with my results.
@tristanjaiden3057
@tristanjaiden3057 2 года назад
@Donovan Atticus It did the trick and I finally got access to my account again. I'm so happy:D Thank you so much, you saved my account !
@donovanatticus5677
@donovanatticus5677 2 года назад
@Tristan Jaiden Happy to help =)
@vinaychandratre4188
@vinaychandratre4188 6 лет назад
GOOD ,LUCID ,QUICK ,TO THE POINT.THANKS
@takeshikovacsn2761
@takeshikovacsn2761 7 лет назад
Thank you this was very helpful information .....signal analysis and frequency response is quite confusing for someone with a good background in electrical engineering
@stormtrooperelite1453
@stormtrooperelite1453 9 лет назад
Hello. Could you help me plotting a correct spectrum of an AM modulated signal. I used FPGA to generate the carrier signal at 33.3kHz, so the samples are all 30 microseconds apart, and in the time domain it appears good. The baseband is 8kHz. The spectrum of the baseband signal is straightforward and spot on (shows 2 frequency components as advertised) but the spectrum of the modulated signal makes no sense
@qasimmohammed7604
@qasimmohammed7604 4 года назад
Thank you very much. Please, How do I know the baseband (BB) from FFT? Hi, I have a signal in the frequency domain on the receiver side, and I need to know the data that I have received to calculate the bit error rate (BER).
@ddorran
@ddorran 9 лет назад
Quasay Hawari, the fftshift function modifies the output of the fft function so that the 0'th bin appears in the centre of the plot. The ceil function rounds up to the nearest integer.
@KA-du7vm
@KA-du7vm 10 лет назад
i want to plot frequency response for x(t/2+6)....please guide me!!
@mtn1241
@mtn1241 4 года назад
Great video!!
@nanacedo5028
@nanacedo5028 6 лет назад
hello i am working on a FMCW Project and have a problem to plot the baseband Signal after mixing the recive Signal and the transmited one.?? please help me!!!! :( :( :(
@dm4728
@dm4728 5 лет назад
Excellent, Many Thanks :)
@awjoybonik818
@awjoybonik818 7 лет назад
Thank you very much for your knowledgeable video. I am working on EMG signal . I made a device which taking EMG signal from human body. The signal I took looks like good. But I don't know how to get frequency of this signal. I have ADC,sampling time,total sample and also used fft to get frequency. But its giving 0.03 Hz (Aprx.) which seems to me not correct. Because EMG signal frequency range is around 5-450 hz. So my question is do I need to change my ADC or any other things thats give me correct frequency?
@abhishekparida22
@abhishekparida22 8 лет назад
Dear Dorran Sir, wouldn't it be convenient to choose N = fs, ALWAYS. For that matter one consistently finds freqBins = freq(in Hz). I wonder, is there an exception where N = fs is not applicable, (because it might ruin the frequency resolution)...
@fendywoo90woo8
@fendywoo90woo8 9 лет назад
hi, I just want to know the format data of your excel file. "Time I Data" ???
@vivekmahadev8896
@vivekmahadev8896 4 года назад
Nicely explained for begineers
@babalukoli1474
@babalukoli1474 7 лет назад
I have frequency signal but this is tool wear signal ,so how I know how much tool wear (micro meter) happen with frequency signal found in MATLAB
@mazinm2006
@mazinm2006 9 лет назад
Sir , you also have to normalize the amplitude of the spectrum by dividing it by N (the number of samples)
@toiyeuhoa
@toiyeuhoa 6 лет назад
Actually, dividing it by N_2 to see the amplitude spectrum ==> each peak is amplitudes of each mixed signal
@jeancarlosadrianza7416
@jeancarlosadrianza7416 4 года назад
Thanks for your clarification.
@jeancarlosadrianza7416
@jeancarlosadrianza7416 4 года назад
@@toiyeuhoa Thanks so much!
9 лет назад
useful. Thank you
@amr.a-m8350
@amr.a-m8350 3 года назад
Great explanation. Thanks for making this. Please the code of spectum
@miftahshidqi7047
@miftahshidqi7047 6 лет назад
i think your code is good, but you have to normalize the amplitude by dividing it by N plot(fax_Hz(1:N_2), X_mags(1:N_2)) ------- you have to change this to this -----> plot(fax_Hz(1:N_2), X_mags(1:N_2)/fs) Thank you for the code
@dinispapinha7416
@dinispapinha7416 3 года назад
Thanks for pointing that out. And btw, it's "plot(fax_Hz(1:N_2), X_mags(1:N_2)./N)" instead of "plot(fax_Hz(1:N_2), X_mags(1:N_2)/fs)"
@rahmatullahorakzai9612
@rahmatullahorakzai9612 4 года назад
Thank you.
@pufarinu
@pufarinu 3 года назад
amazing! thanks!
@wanassaben8269
@wanassaben8269 Год назад
Thank you 🎍🇩🇿
@YTonYahoo
@YTonYahoo 8 лет назад
Thanks. My assignment asks me to state any findings from the signal frequency analysis. We get to choose the signal we want. But what am I supposed to be looking for?
@ddorran
@ddorran 8 лет назад
+David Godfrey You should check with your tutor. Typical features that can be extracted more easily in the frequency domain are fundamental frequencies of a periodic signal (and the strength of its harmonics); the presences of 50-60Hz interference from a mains signal; the presence of noise and the frequency range the noise occupies. This list can go on but hopefully this might give you some ideas.
@user-hi5sv2kk2r
@user-hi5sv2kk2r 6 лет назад
good course
@soumyaruppal1734
@soumyaruppal1734 4 года назад
can we do frequency spectrum of an image?
@andrewhite5353
@andrewhite5353 4 года назад
Dorran how is amplitude computed is 2*X_mags/N.
@billynightingale4851
@billynightingale4851 9 лет назад
Hi David, I was wondering how I could calculate the power spectral density value using Mat-Lab. Thanks for your videos they have been very helpful
@ddorran
@ddorran 9 лет назад
There are built-in functions to do this. periodogram is one that I have used in the past.
@amr.a-m8350
@amr.a-m8350 3 года назад
@@ddorran Yes I need how we could do PSD, value using Mat-Lab. Thanks for your videos they have been very helpful, please.
@qusayhawari4377
@qusayhawari4377 9 лет назад
Ididnt understand this code:- X_mags1 = abs(fftshift(fft(signal))); N1 = length(signal); bin_vals = [0 : N1-1]; N_1 = ceil(N1/2); fax_Hz1 = (bin_vals-N_1)*Fs/N1; why did you take the fftshift, and when you converted from bin valued to HZ you subtracted bin values from ceil(N1/2) ??
@anongvaobeptvnews6004
@anongvaobeptvnews6004 6 лет назад
Let me ask you how to compute the program and plot the unit-step function u (n)
@musangolungu3095
@musangolungu3095 9 лет назад
Thank you for your helpful tutorials. I wanted to ask what is the importance of the Nyquist frequency?
@abdulazizaljaberi7053
@abdulazizaljaberi7053 4 года назад
What kind of data you used?
@mahaghaib5930
@mahaghaib5930 9 лет назад
could you please help me how to compute discrete wavelet transform
@dinaagarenselva5880
@dinaagarenselva5880 10 лет назад
How to plot all the frequency spectrum in one plot?? Cause spectrum welch can't be categorized
@kitinthegym
@kitinthegym 4 года назад
hold on
@rajaduraikanniappan5327
@rajaduraikanniappan5327 10 лет назад
ragheed Al lami DId u get the answer for yourquestion. Because I also had the same question. I would be happy, if you could reply.
@jeancarlosadrianza7416
@jeancarlosadrianza7416 4 года назад
Hi, David. Thanks so much! you have helped me move forward with my homework. I need your support to conclude the same homework: your code allows show a continuous spectrum, but I need to show discrete spectra. Can you tell me how do that? I suppose that I only need 1 or 2 additional instructions but I still don't understand this topic very much. Thanks in advance...
@ddorran
@ddorran 4 года назад
The stem function in place of the plot function should do the job.
@jeancarlosadrianza7416
@jeancarlosadrianza7416 4 года назад
@@ddorran Hi, David. Thanks for your prompt response. Yes: I substituted plot() by stem() and I guess that I have the graphic that I need. Thanks so much! I fully copied your code and I think that was enough to complete my task. :) However, I will try to show information about the phase. Can i show you my code? Thanks again for everything...
@jeancarlosadrianza7416
@jeancarlosadrianza7416 4 года назад
@@ddorran By the way, David: In your opinion, how we can give some use to Nyquist frecuency in the program?
@pankajbhardwaj4861
@pankajbhardwaj4861 2 года назад
M=16 SNR=251 BADWIDTH 1MHz Plot M as a function of SNR from 5 to 40 dB in steps of 1dB using MatLab. Use the same bandwidth as above .plz help me how to do this
@luvmybuddies
@luvmybuddies 10 лет назад
How to identify the positive frequencies and store then in ascending order? hope you could help
@ddorran
@ddorran 10 лет назад
x = rand (1,1000); X = fft(x); X_positive = X(1:length(X)/2); X_positive_sorted = fliplr(sort(abs(X_positive)))
@luvmybuddies
@luvmybuddies 10 лет назад
David Dorran Thanks for the help ..
@luvmybuddies
@luvmybuddies 10 лет назад
David Dorran Could you help me how to compute the Fourier transform for each data stream in xdm. and plot magnitude spectrum for each data stream? thanks in advance
@ronzy369
@ronzy369 10 лет назад
What are the magnitude/ amplitude units? are they units seconds? i.e dB.secs in this case
@ddorran
@ddorran 10 лет назад
There are no units in general - they are the magnitudes of the sinusoidal components which when combined will reproduce a signal. Its the same when looking at a time domain signal - in general a plot will have its y-axis labelled "Amplitude" but if you know what the signal represents then you can change how you label the axis. For example for audio signals the amplitude will correspond to pressure measurements. In the frequency domain the y-axis would then correspond to a measure of pressure at a particular frequency - the units would still be related to pressure.
@ronzy369
@ronzy369 10 лет назад
David Dorran I'm doing a frequency spectra for acceleration, where the input file is in terms of gravity (g). So does this make the units for amplitude g.secs?
@gayatridash31
@gayatridash31 4 года назад
How do we select the proper sampling frequency for analyzing an unknown waveform?
@ddorran
@ddorran 4 года назад
For a completely unknown waveform you can't know an appropriate sampling rate. However, you can take some knowledge about the waveform and what you want to detect into consideration. The basic rule is sample at twice the highest frequency present in the signal you're interested in (or twice the bandwidth). If you don't know the highest frequency present, you could filter out any frequencies above a certain value that may not be of interest. For example, with speech signals you could sample an audio signal at 8 KHz and get an perceptually intelligible representation of the signal. While there will typically be frequencies above 4 KHz in speech we can use our knowledge of how audio signals are perceived to select an appropriate sampling frequency.
@gayatridash31
@gayatridash31 4 года назад
@@ddorran Thanks!
@hendrikbezuidenhout176
@hendrikbezuidenhout176 6 лет назад
Great videos...thanks...How would you plot the phase vs frequency of this data set?
@JaredGordon
@JaredGordon 6 лет назад
You likely have the answer by now, but for anyone else curious; tan inverse theta of the values gained from fft will yield phase. Remember to NEVER sum phases to find ITPC, instead, find avg of the vectors then tan inverse theta of resulting vector
@abhishekpratapsingh1363
@abhishekpratapsingh1363 8 лет назад
What if we change fs to 2000? our frequency component gets changed. how do we balance the changing sampling frequency?
@ddorran
@ddorran 8 лет назад
+Abhishek PRATAP SINGH You would get a corresponding increase in the number of samples over the same signal duration (in seconds).
@abhishekpratapsingh1363
@abhishekpratapsingh1363 8 лет назад
+David Dorran Sir in frequency spectrum entire range is equal to fs. So if fs doubles(becomes 2000) the three sinosoids will now become 30 ,40, and 50 hz which is not true. How do we take care of varying sampling frequency. Also tell how to select sampling frequency.
@r.h7634
@r.h7634 2 года назад
Can you please tell me how to plot a frequency spectrum of a square pulse?
@ddorran
@ddorran Год назад
pulse = [zeros(1,1000) ones(1,100) zeros(1,1000)]; plot(abs(fft(pulse)))
@egemenbora
@egemenbora 3 года назад
I just watched a video about fat in matlab and wanted to save it to my lists and yt said it was marked as content towards children and I cannot save it. Since when children watch fat videos instead of spongebob?
Далее
DFT in Practice  - Frequency Resolution Issues
25:15
Просмотров 32 тыс.
Matlab - Power Spectral Analysis
8:03
Просмотров 28 тыс.
Flo Rida - Whistle НА РУССКОМ 😂🔥
00:29
EVOLUTION OF ICE CREAM 😱 #shorts
00:11
Просмотров 3,6 млн
2DROTS vs RISENHAHA! КУБОК ФИФЕРОВ 2 ТУР
11:31
Signal Processing with MATLAB
21:11
Просмотров 106 тыс.
DFT windowing Explanation and Demo
23:28
Просмотров 47 тыс.
Why Linear Phase Filters are Used
17:33
Просмотров 26 тыс.
Signal Analysis Made Easy
32:13
Просмотров 188 тыс.
Java Is Better Than Rust
42:14
Просмотров 147 тыс.
Flo Rida - Whistle НА РУССКОМ 😂🔥
00:29