Code covered by the BSD License
-
analyseExperimentalData(inFil...
analyseExperimentalData :
-
comparePendulumToSHM(x0,k,m)
comparePendulumToSHM : compare the motion of a simple harmonic oscillator
-
makeSincMovie
Copyright 2008-2009 The MathWorks, Inc.
-
pendulumDE(tVals,omega0,start...
Copyright 2008-2009 The MathWorks, Inc.
-
pendulumDataSimulated(x0, pen...
Generate simulated pendulum data and write this to an Excel spreadsheet.
-
pendulumFitFunction(t,y,param...
pendulumFitFunction : returns the fit value of pendulum model to
-
pendulumSimulation(x0,g,len)
pendulumSimulation : Simulation of pendulum
-
plotFrequencySpectrum(sampleF...
Plot the frequency spectrum of simple harmonic motion
-
plotTimeSeries(res)
Plot the time series representation of simple harmonic motion
-
readExperimentalData(inFileNa...
readExperimentalData : Read in the pendulum experiment data from an Excel
-
shmDataSimulated(x0, springCo...
Generate simulated pendulum data
-
shmSimulation(x0,k,m)
Simulation of SHM with spring constant k and mass m
-
lecture_1_mmcd.m
-
View all files
from
MATLAB in Physics - Visualisation
by Matt McDonnell
The first lecture in a series on using MATLABĀ® in undergraduate physics courses.
|
| plotFrequencySpectrum(sampleFrequency, signalData)
|
function plotFrequencySpectrum(sampleFrequency, signalData)
% Plot the frequency spectrum of simple harmonic motion
% Copyright 2008-2009 The MathWorks, Inc.
% res struct has fields Position, Time
% sampleTime = res.Time(2) - res.Time(1);
% sampleFrequency = 1/sampleTime;
NFFT = 2^nextpow2(numel(signalData));
transformedSignal = fft(signalData,NFFT);
freq = sampleFrequency/2*linspace(0,1,NFFT/2+1);
stem(freq,abs(transformedSignal(1:NFFT/2+1)))
xlabel('Frequency (Hz)');
ylabel('Amplitude');
|
|
Contact us at files@mathworks.com