6 views

Uploaded by Muhammad Yanuar

- lec3
- Spesifikasi Sensor
- EE422-10.pdf
- Mon Taj Geophysics
- Ada 203749
- Fourier Transform for Traders
- Wind, Terrain and Structural Damping Characteristics Under Tropical Cyclone Conditions
- Remote Sensing Diagnosis and Collaborative Maintenance With Web-Enabled Virtual Instruments and Mini-servers
- NPT41_band Pass Processes
- Instantaneous spectral attributes to detect channels.pdf
- Experimental Ship Hydrodynamics Martinus Putra-Xu Cheng.pdf
- Wajac Standard
- wind fatigue dong structural stress method
- Battery Presentation DC 9-29-14
- Lecture 1
- GPR Data Process
- 070917-nas122 cheatsheet
- Modelling and Detection of Camouflaging Worm by Siva.pptx by (2)
- Frequency Analysis and Anti Shock Mechanism of Woodpecker s Head Structure 2014 Journal of Bionic Engineering
- Methods of Formant Tracking Fadhlis

You are on page 1of 5

An analog sinusoid can be described by the function x(t) = A.sin(2.f.t + )

A is the amplitude, f the frequency and is the phase angle in radians.

Assume that we will generate a sinusoid with N samples that includes f periods.

Calculate a set of number to be used as a time scale.

N = 0:N-1; % The numbers are n(1) = 0, N(2) = 1,.. n(N) = N-1

The frequency f can be interpreted as the number of periods per sample (f/N), since we

obtain f periods in N samples.

The signal can be described as: x = sin(2**f*n/N + );

During the total sampling period T = 1 sec we will get f periods and N samples. The sampling

time ts = 1/N sec. The sampling frequency fs = 1/ts = N Hz.

The Fourier transform is: Fx = fft(x);

Magnitude spectrum is: MFx = abs(fft(x)); or

Plot the spectrum : plot(MFx) or stem(MFx)

MFx = abs(Fx);

Frequency analysis of an even number of samples give the Nyqvist frequency at N/2 Hz and

the frequency resolution is df = 1/T = 1 Hz.

On the horizontal axis, the positive frequencies occupy the left half of the axis and the

negative frequencies occupy the right half. The figure shows how MatLab plots the

spectrum.

140

f = 10 Hz N = 256sample

120

100

80

60

Nyqvist frequency

40

20

Positive frequencies

50

100

Negative frequencies

150

200

250

The frequency with index n = 1 is zero. The numbers will be displaced by 1 step by plotting

the spectrum. We have to introduce a positive frequency axis numbered fro 0 to N/2 - 1.

We can use the earlier defined variable n to number the frequency axis.

function

x=signal(f,N)

% sinusoid

% f=frequency, N=number of samples

% Total sampling time = 1 second

n = 0:N-1; % numbering the samples

x = sin(2*pi*f*n/N);

plot(x)

MFx = abs(fft(x));

plot(n(1:N/2),MFx(1:N/2)) % plot positive frequencies

which center the frequencies around f = 0 that will be numbered N/2.

MFx = fftshift(abs(fft(x))); plot(MFx)

140

f = 10 Hz N = 256sample

120

100

80

60

40

20

Negative frequencies

50

Positive frequencies

100

150

200

250

The signal and the spectrum can be plotted together with the commands:

subplot(2,1,1); plot(x)subplot(2,1,2);

plot(n(1:N/2),MFx(1:N/2))

1

0.5

0

-0.5

-1

50

100

150

200

250

50

100

150

200

250

150

100

50

If we want to study the real- and imaginary part of the spectrum, we can extract these parts

by the commands:

RFX = real(Fx);

IFX = imag(Fx);

In the example we have been sampling during 1 sec and the frequency resolution is 1 Hz.

If we specify the sampling frequency to fs, which frequency resolution will we have?

With N sample the total sampling period is T = N/fs.

The frequency resolution df = 1/T = fs/N. Due to the symmetrical properties of the spectrum

we only use the positive frequencies.

The signal will be: x = sin(2*pi*f*n/fs);

The frequency scale is: frek = (0:N/2-1)*fs/N;

and we can plot the positive frequencies with:

plot(frek,MFx(1:N/2))

A function that generates a sinusoid with the sampling frequency fs can look like this:

function

%

%

%

%

x=signal(f,fs,N)

sinusoid

f=frequency, N=number of samples

fs=sampling frequency

Total sampling time = 1 second

x = sin(2*pi*f*n/fs);

plot(x)

MFx = abs(fft(x));

frek=(0:N/2-1)*fs/N;

plot(frek,MFx(1:N/2))% plot the positive frequencies

you can add amplitude and phase angle to the function, and also determine how many

samples that will be plotted:

Function sinewave(N,f,fs,np)

% sinwave calculate and plot a sinusoid with N sample

% sampling frequency fs, frequency f and plot np

% samples

t=(0:N-1)/fs;

x = sin(2*pi*t*f);

plot(t(1:np),x(1:np))

A square wave is generated by: y = sign(sin(2*pi*f*n/N));

Another function is square that also can generate asymmetrical pulse trains.

A sawtooth signal can be generated by: sawtooth(2*pi*f*n/N,0.5);

Some other functions are: pulstran, rectpuls, tripuls, gauspuls

.wav-files is a standard audio format in PC computers that can be handled by many programs.

MatLab can read and write .wav-files wit the following commands:

MatLab. Fs and bits extracts the sampling frequency and the bit resolution of the sampled signal.

wavwrite(x,Fs, filename) writes the vector x in a file with samplingfrequency Fs.

The standard resolution is 16 bits or 32768 levels. The amplitude is restricted to the interval [-1,+1]

in the vector x.

Assume we have following parameters:

N = samples, fs = sampling frequency, fa = frequency of the .wav-file

A sinusoid will have the right frequency with the command: y = sin(2*pi*fa*n/fs);

Example: Generate a sinusoid with amplitude 0.1, frequency 100 Hz with 100000 samples and

sampling frequency 22050 Hz. Listen to the signal and save it to a .wav-file.

Total time for the signal is N/fs = 4.535 s.

x = 0.1*sin(2*pi*fa*n/fs);

sound(x,fs)

wavwrite(x,fs,sinsound.wav);

If we take M samples of the signal, the total sampling time will be: T = M/fs

The frequency resolution is: df = 1/T = fs/M

Magnitude spectrum is: Fx = abs(fft(x))

We can generate a frequency axis for positive frequencies: frek=(0:M/2-1)*fs/N

Plotting the spectrum: plot(frek,Fx(1:M/2))

- lec3Uploaded byvlsiprabhu
- Spesifikasi SensorUploaded byMuhammad Balyan
- EE422-10.pdfUploaded byLtarm Lam
- Mon Taj GeophysicsUploaded byM Hasan Basri
- Ada 203749Uploaded byabhi71127112
- Fourier Transform for TradersUploaded bymarkt12345
- Wind, Terrain and Structural Damping Characteristics Under Tropical Cyclone ConditionsUploaded byAMVOS90
- Remote Sensing Diagnosis and Collaborative Maintenance With Web-Enabled Virtual Instruments and Mini-serversUploaded bymani85a
- NPT41_band Pass ProcessesUploaded byprasoon
- Instantaneous spectral attributes to detect channels.pdfUploaded byMohand76
- Experimental Ship Hydrodynamics Martinus Putra-Xu Cheng.pdfUploaded byMartinus Putra
- Wajac StandardUploaded byajay
- wind fatigue dong structural stress methodUploaded byGuilherme Alencar
- Battery Presentation DC 9-29-14Uploaded bySajjad Hossain
- Lecture 1Uploaded byNaveed Ramzan
- GPR Data ProcessUploaded byNaivedya Jagdish Prasad Mishra
- 070917-nas122 cheatsheetUploaded byDasaka Brahmendra
- Modelling and Detection of Camouflaging Worm by Siva.pptx by (2)Uploaded bychikatisivashankar
- Frequency Analysis and Anti Shock Mechanism of Woodpecker s Head Structure 2014 Journal of Bionic EngineeringUploaded byjack
- Methods of Formant Tracking FadhlisUploaded byanjalidpande
- 1420-8376-1-PB.pdfUploaded bySwamy Mani
- WavesUploaded bykaushik247
- Chapter 1_Part 1.pptxUploaded byCarmen Elizabeth
- OCW_3_Electronic_Instrumentation_Noise_and_Interference.pdfUploaded byAhmad Hamouda
- CE 7014 Chap2 Part 4Uploaded byAnonymous ep7LE5ZdP5
- WavelengthPeriodFrequency QuestionsUploaded bysalmasoma
- 8051 Progtam for Calculating Unknown FrequencyUploaded byapi-3857743
- INST+ +Measurement+of+FrequencyUploaded byhammad100
- 7540_GCE_O_Physics_msc_20080807Uploaded bymustafa27
- 201071163549_d023Uploaded byZulfani Aziz

- intro.docxUploaded bykhairi_mohammad
- RelativityUploaded byRavi Kiran N
- Iprofphenc05t01st01.Notes.1pUploaded bySaiSpan
- Chapter 1 & 2 - Introduction to Vibrations and Single DOF Systems (1)Uploaded byMohamad Faiz Tony
- LabUploaded byJeff Kwh
- 1A. Scalar and VectorUploaded byHadirah Dunglah
- Main Topics and SubtopicsUploaded bysuhailielias
- Daily Weather Reports 1917 07Uploaded byDruid_ian
- Underwater Acoustic Noise Measurement in Test TanksUploaded byhnikfazan
- KellyUploaded byGupta GurunadhGupta
- An Introduction to AeroacousticsUploaded bylax_dora
- SpecializationUploaded byApril Joyce Ricamora Narciso
- 2016_11_lyp_physics_01_qpUploaded byKunal Rohitas
- What is EnergyUploaded byulanrain311
- AGRI19Uploaded byVigneshkumar Natarajan
- Park Masw S-tr284Uploaded bymelomanozalo
- Homework1 Answer Key Quantum ChemistryUploaded byLuther James Langston II
- Analogy of Tesla’s and recent measurementsUploaded bygmarjanovic
- I.E - Circular Motion and RotationUploaded byAnonymous xspOY8ycn
- Internal Structure of the SunUploaded byShikhar Goenka
- BurstCatalog.pdfUploaded bySyifa Ul Husna
- FlashUploaded byArul Winner
- ASTM C 634 Standard Terminology Relating to Building and Environmental Acoustics.pdfUploaded bySuraj Rawat
- Physics MechanicsUploaded byAamer
- Fundamentals of Heat TransferUploaded byJonathan Tin
- Física I 8L TALLER FINAL_ESTUDIANTEUploaded byprincipesho
- CARLOSON_RIPLEY_1997_On the Relation Between NDVI Fractional Vegetation Cover and Leaf Area IndexUploaded byLilliane Renata Defante
- 1st Year Physics Important Mcqs for the Exam 2013Uploaded byAnwer Ali
- Synthesis, Characterization and Optical properties of PANI/ PVA Blends.Uploaded byIOSRjournal
- practice brachytherapy problemsUploaded byapi-213116779