SlideShare une entreprise Scribd logo
1  sur  1
Télécharger pour lire hors ligne
MATLAB CODING
Say I had a signal = T
and I computed the the fourier transform so X = fft(T)
and I computed a suitable frequency vector k = linspace(-fs/2,fs/2,length(X)+1)
k = k(1:end-1)
I need to find the peaks in the magnitude spectrum (which in this case occur over values of 1)
and from them find the corresponding amplitude and angle to these peaks.
I'm assuming it would go something like
[peaks,locs] = findpeaks(abs(X)./fs,k,'MinPeakHeight',1)
amplitude = X(locs)
phase = angle(X(locs))
Any advice would be great
Solution
%MATLAB Code begins
%Vector T contains the input signal which is to be analyzed and fs is the sampling frequency
y = fft(t); %computing the Fast Fourier Transform
l = length(T); %storing the length of input signal
f = fs * (0:l-1) / l; %defining the frequency domain of the Fourier Transform
[pks,locs] = findpeaks(y,'MinPeakHeight',1); %finding the peaks and their locations in the
Fourier Transform
abs(y(locs)) %displaying the amplitude of peaks
angle(y(locs)) %displaying the angle of peaks
f(locs) %displaying the frequencies corresponding to which the peaks occur
%MATLAB Code ends

Contenu connexe

Similaire à MATLAB CODINGSay I had a signal = Tand I computed the the fourie.pdf

Ss important questions
Ss important questionsSs important questions
Ss important questions
Sowji Laddu
 
Stochastic Calculus, Summer 2014, July 22,Lecture 7Con.docx
Stochastic Calculus, Summer 2014, July 22,Lecture 7Con.docxStochastic Calculus, Summer 2014, July 22,Lecture 7Con.docx
Stochastic Calculus, Summer 2014, July 22,Lecture 7Con.docx
dessiechisomjj4
 

Similaire à MATLAB CODINGSay I had a signal = Tand I computed the the fourie.pdf (20)

Fourier series
Fourier seriesFourier series
Fourier series
 
Computational Method to Solve the Partial Differential Equations (PDEs)
Computational Method to Solve the Partial Differential  Equations (PDEs)Computational Method to Solve the Partial Differential  Equations (PDEs)
Computational Method to Solve the Partial Differential Equations (PDEs)
 
Fourier transform
Fourier transformFourier transform
Fourier transform
 
AJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdfAJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdf
 
Ss important questions
Ss important questionsSs important questions
Ss important questions
 
unit 4,5 (1).docx
unit 4,5 (1).docxunit 4,5 (1).docx
unit 4,5 (1).docx
 
Stochastic Calculus, Summer 2014, July 22,Lecture 7Con.docx
Stochastic Calculus, Summer 2014, July 22,Lecture 7Con.docxStochastic Calculus, Summer 2014, July 22,Lecture 7Con.docx
Stochastic Calculus, Summer 2014, July 22,Lecture 7Con.docx
 
Ft3 new
Ft3 newFt3 new
Ft3 new
 
Ch4 (1)_fourier series, fourier transform
Ch4 (1)_fourier series, fourier transformCh4 (1)_fourier series, fourier transform
Ch4 (1)_fourier series, fourier transform
 
Dsp manual
Dsp manualDsp manual
Dsp manual
 
Pulse Modulation ppt
Pulse Modulation pptPulse Modulation ppt
Pulse Modulation ppt
 
Fourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time SignalsFourier Series for Continuous Time & Discrete Time Signals
Fourier Series for Continuous Time & Discrete Time Signals
 
pulse modulation technique (Pulse code modulation).pptx
pulse modulation technique (Pulse code modulation).pptxpulse modulation technique (Pulse code modulation).pptx
pulse modulation technique (Pulse code modulation).pptx
 
Harmonic wave physics
Harmonic wave physicsHarmonic wave physics
Harmonic wave physics
 
Laplace transform
Laplace transformLaplace transform
Laplace transform
 
senior seminar
senior seminarsenior seminar
senior seminar
 
On Spaces of Entire Functions Having Slow Growth Represented By Dirichlet Series
On Spaces of Entire Functions Having Slow Growth Represented By Dirichlet SeriesOn Spaces of Entire Functions Having Slow Growth Represented By Dirichlet Series
On Spaces of Entire Functions Having Slow Growth Represented By Dirichlet Series
 
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLABDIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
 
z transforms
z transformsz transforms
z transforms
 
Fixed Point Theorm In Probabilistic Analysis
Fixed Point Theorm In Probabilistic AnalysisFixed Point Theorm In Probabilistic Analysis
Fixed Point Theorm In Probabilistic Analysis
 

Plus de Akashayhandicraft789

Metrology (What it is, What it encompasses, how it relates to Qualit.pdf
Metrology (What it is, What it encompasses, how it relates to Qualit.pdfMetrology (What it is, What it encompasses, how it relates to Qualit.pdf
Metrology (What it is, What it encompasses, how it relates to Qualit.pdf
Akashayhandicraft789
 
Mel OConner owns rental properties in Michigan. Each property has .pdf
Mel OConner owns rental properties in Michigan. Each property has .pdfMel OConner owns rental properties in Michigan. Each property has .pdf
Mel OConner owns rental properties in Michigan. Each property has .pdf
Akashayhandicraft789
 
Measuring treatment outcomes asSolutionThe following is an ext.pdf
Measuring treatment outcomes asSolutionThe following is an ext.pdfMeasuring treatment outcomes asSolutionThe following is an ext.pdf
Measuring treatment outcomes asSolutionThe following is an ext.pdf
Akashayhandicraft789
 
Match the term with the letter corresponding to the definition in th.pdf
Match the term with the letter corresponding to the definition in th.pdfMatch the term with the letter corresponding to the definition in th.pdf
Match the term with the letter corresponding to the definition in th.pdf
Akashayhandicraft789
 

Plus de Akashayhandicraft789 (17)

Miceconomics African elephants arc endangered, but cows are not beca.pdf
Miceconomics African elephants arc endangered, but cows are not beca.pdfMiceconomics African elephants arc endangered, but cows are not beca.pdf
Miceconomics African elephants arc endangered, but cows are not beca.pdf
 
Metrology (What it is, What it encompasses, how it relates to Qualit.pdf
Metrology (What it is, What it encompasses, how it relates to Qualit.pdfMetrology (What it is, What it encompasses, how it relates to Qualit.pdf
Metrology (What it is, What it encompasses, how it relates to Qualit.pdf
 
metals frequently form solutions with other atoms. What are the two .pdf
metals frequently form solutions with other atoms. What are the two .pdfmetals frequently form solutions with other atoms. What are the two .pdf
metals frequently form solutions with other atoms. What are the two .pdf
 
Merell (1997), studied the effects of different kinds of music on th.pdf
Merell (1997), studied the effects of different kinds of music on th.pdfMerell (1997), studied the effects of different kinds of music on th.pdf
Merell (1997), studied the effects of different kinds of music on th.pdf
 
Mendelian inheritance. Some traits of plants and animals depend on i.pdf
Mendelian inheritance. Some traits of plants and animals depend on i.pdfMendelian inheritance. Some traits of plants and animals depend on i.pdf
Mendelian inheritance. Some traits of plants and animals depend on i.pdf
 
Mel OConner owns rental properties in Michigan. Each property has .pdf
Mel OConner owns rental properties in Michigan. Each property has .pdfMel OConner owns rental properties in Michigan. Each property has .pdf
Mel OConner owns rental properties in Michigan. Each property has .pdf
 
Medication adherence among HIV+ adultsEffects of cognitive dysfun.pdf
Medication adherence among HIV+ adultsEffects of cognitive dysfun.pdfMedication adherence among HIV+ adultsEffects of cognitive dysfun.pdf
Medication adherence among HIV+ adultsEffects of cognitive dysfun.pdf
 
Media specialists know that receivers engage in selective retention,.pdf
Media specialists know that receivers engage in selective retention,.pdfMedia specialists know that receivers engage in selective retention,.pdf
Media specialists know that receivers engage in selective retention,.pdf
 
Measuring treatment outcomes asSolutionThe following is an ext.pdf
Measuring treatment outcomes asSolutionThe following is an ext.pdfMeasuring treatment outcomes asSolutionThe following is an ext.pdf
Measuring treatment outcomes asSolutionThe following is an ext.pdf
 
Measures of central tendency give information about typical scores i.pdf
Measures of central tendency give information about typical scores i.pdfMeasures of central tendency give information about typical scores i.pdf
Measures of central tendency give information about typical scores i.pdf
 
MC#4 Which of the following statements is most CORRECT a. In a typ.pdf
MC#4 Which of the following statements is most CORRECT a. In a typ.pdfMC#4 Which of the following statements is most CORRECT a. In a typ.pdf
MC#4 Which of the following statements is most CORRECT a. In a typ.pdf
 
May a minor enter into a contract with an adult Are both parties eq.pdf
May a minor enter into a contract with an adult Are both parties eq.pdfMay a minor enter into a contract with an adult Are both parties eq.pdf
May a minor enter into a contract with an adult Are both parties eq.pdf
 
Maximum combustion temperature in gas turbines is of the order of 11.pdf
Maximum combustion temperature in gas turbines is of the order of 11.pdfMaximum combustion temperature in gas turbines is of the order of 11.pdf
Maximum combustion temperature in gas turbines is of the order of 11.pdf
 
Math Analysis questionPlease determine compactness and connectedn.pdf
Math Analysis questionPlease determine compactness and connectedn.pdfMath Analysis questionPlease determine compactness and connectedn.pdf
Math Analysis questionPlease determine compactness and connectedn.pdf
 
Materials questions The intersections of which two lines in a phase.pdf
Materials questions The intersections of which two lines in a phase.pdfMaterials questions The intersections of which two lines in a phase.pdf
Materials questions The intersections of which two lines in a phase.pdf
 
Match the term with the letter corresponding to the definition in th.pdf
Match the term with the letter corresponding to the definition in th.pdfMatch the term with the letter corresponding to the definition in th.pdf
Match the term with the letter corresponding to the definition in th.pdf
 
Match the proposed probability of A with the appropriate verbal desc.pdf
Match the proposed probability of A with the appropriate verbal desc.pdfMatch the proposed probability of A with the appropriate verbal desc.pdf
Match the proposed probability of A with the appropriate verbal desc.pdf
 

Dernier

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Dernier (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 

MATLAB CODINGSay I had a signal = Tand I computed the the fourie.pdf

  • 1. MATLAB CODING Say I had a signal = T and I computed the the fourier transform so X = fft(T) and I computed a suitable frequency vector k = linspace(-fs/2,fs/2,length(X)+1) k = k(1:end-1) I need to find the peaks in the magnitude spectrum (which in this case occur over values of 1) and from them find the corresponding amplitude and angle to these peaks. I'm assuming it would go something like [peaks,locs] = findpeaks(abs(X)./fs,k,'MinPeakHeight',1) amplitude = X(locs) phase = angle(X(locs)) Any advice would be great Solution %MATLAB Code begins %Vector T contains the input signal which is to be analyzed and fs is the sampling frequency y = fft(t); %computing the Fast Fourier Transform l = length(T); %storing the length of input signal f = fs * (0:l-1) / l; %defining the frequency domain of the Fourier Transform [pks,locs] = findpeaks(y,'MinPeakHeight',1); %finding the peaks and their locations in the Fourier Transform abs(y(locs)) %displaying the amplitude of peaks angle(y(locs)) %displaying the angle of peaks f(locs) %displaying the frequencies corresponding to which the peaks occur %MATLAB Code ends