MATLAB code help to generate a graph of amplitude of the Fouriertransform (FFT), vs. signal frequency (Hz) comparison betweensignals measured. Thank you!
Looking for a similar graph as below but with only a single dataset
For example purposes, imported Fxx_Fsyy.mat file gives variablestArduino (1x230 double) where values ranged from 0 up to 0.99sequentially and vArduino (1x230 double) with values ranging from 0to 5 randomly. Numbers can be assumed random for code creatingpurposes.
Example matlab code/.m file for running a Fourier transform on arandom signal
Current code interpreted so far for importing in data (just myidea, doesn't need to be followed):
Thank you again for the help!
Q10 Graph 2 F=92, Fs=230 F=92 Fs=400 F=161 Fs=230 F=161 Fs=400 1.8 1.6 1.4 1.2 Amplitude 0.8 0.6 0.4 0.2 20 40 60 140 160 180 200 80 100 120 Frequency[Hz] Figure 3. Frequency domain (amplitude of the Fourier transform, |FT), vs. signal frequency) comparison between signals measured via the Arduino. The data is provided as Fxx_Fsyy.mat where xx is the frequency of the input signal and yy is the sampling frequency. Each mat file contains variables tArduino - The timestamp of the arduino samples in seconds VArduino - The voltage measurement of the arduino There is also a script that is an example file running a fourier transform on a signal. You will use this file to help you run transforms on all the data sets. = = FFT (tvar, yvar) Fs = 10000; time (0:1/Fs:1); % Time vector signal = sin(2*pi*30*time); figure (1); plot (time, signal) figure (2) [freq, amp]=FFT (time, signal); plot (freq, amp) function [frequencyVar, amplitudeVar] L = length(tVar); fftAmpl = fft (yVar); Fs = 1/(tvar (2)-tVar(1)); P2 abs (fftAmpl/L); P1 = P2 (1:L/2+1); P1 (2:end-1) = 2*21 (2:end-1); frequencyVar = Fs* (0:(L/2))/L; amplitudeVar P1; end clear all newDatal = load ('Fxx_Fsyy.mat'); %import file vars = fieldnames (newDatal); Screate new variables in base workspace from fields for i = 1:length (vars) assignin ('base', vars{i}, newDatal. (vars{i})); end